-
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): reevaluate page query when page context is modified #15404
fix(gatsby): reevaluate page query when page context is modified #15404
Conversation
Ping @pieh (you reviewed the previous PR) |
Right. There is problem with this that I'm not sure if I noted in previous implementation. This will work only when context is modified while |
@pieh, I think that was fixed here: gatsby/packages/gatsby/src/redux/actions/public.js Lines 344 to 345 in 38eda62
|
This is what I actually meant. |
@pieh thanks for clarification!
Oh, I see. I just verified that this issue happens between builds:
That's a more severe issue... I don't know how to fix it as part of this PR though. Persisting page data is a separate bigger PR. I believe we can't assume context to be changed every time when I believe this PR can be merged and a separate issue should be open for "between-builds" context changes. I will be able to work on this fix. |
Sorry to bother you @pieh... but this is a severe issue: build may produce wrong results without the user noticing it. Could you at least let me know what is your plan on this? Won't you merge this PR without a complete fix? Should I start working on a complete fix? Thanks in advance. |
Yeah, this is bigger issue. The fix might be tiny (i.e. just persist
I think it makes sense to merge this in general, but I didn't have yet time to thoroughly review and see if it can potentially cause some regressions. |
After some using in production, I noticed a severe performance issue with my changes: instead of rerunning only specific page query it was rerunning all page queries of a specific component. @pieh any chance to get it merged soon? |
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.
@RomanHotsiy This seems like a valuable fix. Tested and verified locally!
I've documented the issue for gatsby build
in #16477
Let's go ahead and publish this for now! Thank you 🥇
Published in |
Description
When page context is updated by createPage the path is not marked as dirty and page query is not reevaluated resulting in the page not updating in develop mode.
It was already fixed by my in #11048 but it appeared again in v2.2.11 because of refactoring by @KyleAMathews in 91086d4
I added a basic test, but I'm not sure how to write a test to prevent this kind of regression in the future. If anyone has any ideas I would be happy to add a test.
Related Issues
Related to #6097, May be related to #11691