Skip to content

Commit c7b876b

Browse files
committed
Comments to explain normalize functions
Signed-off-by: Adam Mould <[email protected]>
1 parent 31cd3b6 commit c7b876b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/gatsby-source-wordpress/src/normalize.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ exports.liftRenderedField = entities =>
137137
})
138138

139139
// Exclude entities of unknown shape
140+
// Assume all entities contain a wordpress_id, except for whitelisted type wp_settings
140141
exports.excludeUnknownEntities = entities =>
141142
entities.filter(e => e.wordpress_id || e.__type === `wordpress__wp_settings`) // Excluding entities without ID, or WP Settings
142143

144+
// Create node ID from known entities
145+
// excludeUnknownEntities whitelisted types don't contain a wordpress_id
146+
// we create the node ID based upon type if the wordpress_id doesn't exist
143147
exports.createGatsbyIds = (createNodeId, entities) =>
144148
entities.map(e => {
145149
if (e.wordpress_id) {

0 commit comments

Comments
 (0)