-
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
Regression in #35271 #35366
Comments
I think it may be a race condition where
_doResolvePrepareNodesQueue is executing for the same node twice, but on the second pass the redux store hasn't yet updated, so
getResolvedNodes returns nothing so the merge doesn't happen and the second update clobbers the first. I can't seem to get logging to work inside the reducer to confirm, however. (redux treats any console.log lines in a reducer as a dispatch and errors out)
|
Thank you for doing research on this @fshowalter, will be looking into this one. I think you are completely right -
Right, sorry about this annoyance. You can use |
@pieh Thanks. Mystery deepens, adding the logging I don't see any instances of |
Try running with CI=1 env var - this disables animation for spinners and progress bars (terminal "rewrites" for spinner/progress bar animations can "overwrite" and delete untracked terminal outputs that are done with |
I started work on this - for now added failing test (based on research shared in #35366 (comment) ) I think other than fixing concurrency issue with seting resolved fields I will also spend some time on actual gatsby/packages/gatsby/src/schema/resolvers.ts Lines 115 to 140 in de86cb7
I think we do need to apply similar check as we have in gatsby/packages/gatsby/src/datastore/in-memory/indexing.ts Lines 362 to 369 in e24ec76
The setup currently is quite error prone, I'll also try to think if we can use TypeScript to differentiate "raw" |
Confirmed. I can see the two actions come through the reducer with the same node ids, but different values, and the second clobbers the first. The trick was adding that |
Thank you @pieh, you've made my Gatsby debugging life so much easier 😄 |
@pieh Just checking on this one. Anything I can do to help? |
Preliminary Checks
Description
#35271 introduced a regression where a node will be marked as resolved despite only a possible subset of resolvable fields actually being resolved. This is manifesting in my site where I have a query that runs DISTINCT over several resolvable fields. What it looks like is happening, is Gatsby is taking a SINGLE node and using it for the DISTINCT resolutions which in turn sets it into the "resolved" cache, but only the DISTINCT fields will be resolved. Subsequent queries for the non-resolved fields ON THAT NODE will fail, as Gatsby thinks they're already resolved.
Imagine a blog with a series of posts. Your index page query does a DISTINCT on a resolvable field. For a SINGLE post (whichever one Gatsby pulls--not sure how it picks) this field will resolve and Gatsby will add the node to the cache (line 501 in packages/gatsby/src/schema/node-model.js) with that field resolved but any other resolvable fields will be undefined.
Reproduction Link
fshowalter/franksbooklog.com#30
Steps to Reproduce
Expected Result
A node should not be marked as globally resolved unless all fields are resolved.
Actual Result
A node is marked as resolved but only a subset of its fields are actually resolved.
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: