Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-source-wordpress] Treat wp settings as a known type for inclusion #5708

Merged
Merged
Changes from 2 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -138,11 +138,15 @@ exports.liftRenderedField = entities =>

// Exclude entities of unknown shape

This comment has been minimized.

Copy link
@pieh

pieh Jun 5, 2018

Contributor

Can you add some context to function description comment so it's easier for future contributors? That we assume that all entities need ids except for whitelisted types (currently just settings)

exports.excludeUnknownEntities = entities =>
entities.filter(e => e.wordpress_id) // Excluding entities without ID
entities.filter(e => e.wordpress_id || e.__type === `wordpress__wp_settings`) // Excluding entities without ID, or WP Settings

exports.createGatsbyIds = (createNodeId, entities) =>
entities.map(e => {
e.id = createNodeId(`${e.__type}-${e.wordpress_id.toString()}`)
if (e.wordpress_id) {

This comment has been minimized.

Copy link
@pieh

pieh Jun 5, 2018

Contributor

here would be good idea to put comment mentioning excludeUnknownEntities and why we have to ways of creating node id

e.id = createNodeId(`${e.__type}-${e.wordpress_id.toString()}`)
} else {
e.id = createNodeId(e.__type)
}
return e
})

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.