Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Fetching nested connections to nodes that can't be fetched in a flat list #63

Closed
TylerBarnes opened this issue Jul 14, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request todo after v4 release topic: WordPress Related to Gatsby's integration with WordPress

Comments

@TylerBarnes
Copy link
Collaborator

TylerBarnes commented Jul 14, 2020

Fetching nested connections to nodes that can't be fetched in a flat list causes nodes to be missed on the Gatsby side.

For example, in previous versions of WPGraphQL, nested menu items on menus couldn't be fetched because there was no way to properly fetch those nodes in a flat list.

What we could do to account for this situation is: as nodes are sourced and analyzed, store up every connected id fetched on every node. Once node sourcing is complete, check to see if we fetched all those nodes. For the nodes that weren't fetched, try to fetch them. If any of them come back null, mark that they're unfetchable, for the ones that do return data, create nodes. Then repeat on any missing child node ids until we have nodes for all child id's.

This is actually not a problem in WPGQL core anymore since everything can be fetched in a flat list now. I'm sure this will be needed to support WPGQL extensions though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request todo after v4 release topic: WordPress Related to Gatsby's integration with WordPress
Projects
None yet
Development

No branches or pull requests

2 participants