-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby): track connections by default in runQuery and getAllNodes #29392
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New version of graphql-compose adds type composers added via `createTemp` to schemaComposer. So before the upgrade `schemaComposer.has(typeName)` always returned false for temp types, now it returns true (as the temp composer is already added).
In the new version of graphql-compose the list of actual final types is stored in SchemaComposer itself, not TypeMapper. Also the same composer may have multiple keys
graphql-compose now adds temporary types to schemaComposer which is unfortunate. The suggested workaround is not to pass schemaComposer to createTemp (so use new schemaComposer under the hood). That's what we do here but still use the original composer to resolve fields and types.
Those thunks cause stack overflow in graphql-compose. Indicates a bug in graphql-compose that warrants additional investigation.
graphql-compose introduced another behavior change for input type generation and unions. Previously it was ignoring fields of union types, now it throws. Introduced here: graphql-compose/graphql-compose@b6363be
Another behavior change is that inputTypeComposer.getFields() now returns a map of fields where types are composers while our current code expects types to be types of graphql-js
Also had to update tests due to this issue: graphql-compose/graphql-compose#313
…type composer `typeComposer.getInterfaces()` now returns a list of interface composers not `GraphQLInterface` instances. Also schemaComposer has multiple entries of the same type with different keys now.
…ema merging" This reverts commit 395e460
`getType` method creates AST node under the hood that produces a duplicate type in the schema 🤷
GraphQL 15 is stricter with enum values after graphql/graphql-js#1827
GraphQL 15 is stricter with enum values after graphql/graphql-js#1827
graphql-compose will unwrap `interfaces` and `types` thunk right away. As a result it may try to access some types before they were added to schemaComposer
gatsbot
bot
added
the
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
label
Feb 8, 2021
vladar
added
topic: GraphQL
Related to Gatsby's GraphQL layer
and removed
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
labels
Feb 8, 2021
vladar
commented
Feb 8, 2021
# Conflicts: # packages/gatsby/src/schema/__tests__/rebuild-sitepage-type.js
pieh
reviewed
Feb 9, 2021
pieh
approved these changes
Feb 9, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please!
pragmaticpat
pushed a commit
to pragmaticpat/gatsby
that referenced
this pull request
Apr 28, 2022
gatsbyjs#29392) * feat(gatsby): track runQuery connections by default * track getAllNodes connections by default too * update tests * getAllNodes: track Node connection * Allow to opt-out of dependency tracking
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add connection tracking by default for
runQuery
andgetAllNodes
. Before this PR whenever you userunQuery
orgetAllNodes
we track data relations per node not connection (unless you explicitly record connection relation).As a result when a new node is added - we don't re-run all queries that can be potentially affected which leads to stale pages in builds.
Both methods have a second argument with
pageDependencies
. But people tend to omit it and rely on defaults.New default is
opt-in
but people can stillopt-out
manually like this:or (for
runQuery
):Documentation
https://www.gatsbyjs.com/docs/page-node-dependencies/
Related Issues
Fixes #27940