-
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
fix(gatsby): invalidate queries if page context changes between runs #28351
Conversation
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.
Looks good to me 👍 At least I don't see any pitfalls with this approach.
@@ -806,7 +807,7 @@ describe(`query caching between builds`, () => { | |||
}, 99999) | |||
}) | |||
|
|||
describe.skip(`Changing page context invalidates page queries`, () => { | |||
describe(`Changing page context invalidates page queries`, () => { |
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.
🎉
Ok, this is not sufficent change. As I noted in the description
Just did run some manual tests for it. For cases when we:
This result in build error as follows:
So we do need to cover properly cleaning up reducer that we will persist |
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.
Just trying to discard my review after @pieh request
To add to my above comment - just adding |
This is successor to #28316 which had potential of causing OOM crashes when persisting/serializing data in case there was huge amount of data passed via page context.
Instead of persisting entire page objects this persists just hash generated from page context which should minimize how much more data will be persisted (and hopefully avoid OOM crashes)
TODO:
gatsby/packages/gatsby/src/services/create-pages.ts
Line 57 in c4978e9
pages
slice which is not persisted - so it's entirely possible that this will keep stale page context hashes around. Potential solution here would be to add timestamp to newly added reducer (maybe even just move current ones we have inpages
to new one) and switch to using new (persisted) slice of redux state for finding pages that were not re-created.Related Issues
fixes #28281
fixes #26520
[ch19791]