-
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): handle case of html and data files mismatch #34225
Merged
wardpeet
merged 13 commits into
master
from
fix/handle-html-out-of-sync-on-initial-render
Dec 17, 2021
Merged
fix(gatsby): handle case of html and data files mismatch #34225
wardpeet
merged 13 commits into
master
from
fix/handle-html-out-of-sync-on-initial-render
Dec 17, 2021
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
gatsbot
bot
added
the
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
label
Dec 9, 2021
pieh
added
topic: frontend
Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation)
and removed
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
labels
Dec 9, 2021
…ta which can already be mismatched and just wrong
…doesnt is different than hash in app-data
pieh
force-pushed
the
fix/handle-html-out-of-sync-on-initial-render
branch
from
December 9, 2021 12:07
2f1e899
to
f8d51f2
Compare
I like this a lot. This would handle both hosts that don't force validation on html files + service worker issues. Nice work! |
…-of-sync-on-initial-render
… caching making it impossible :(
pieh
commented
Dec 16, 2021
wardpeet
approved these changes
Dec 17, 2021
2 tasks
I think this may solve #33112 as well. |
@aaronadamsCA let us know if it does! Would be great to validate that hypothesis. |
2 tasks
Might need to resolve #34484 before getting a read on this. |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
topic: frontend
Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation)
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
If for whatever reason html content from old deploys gets loaded (some cases of browser cache), that old html will load old
.js
bundles. Thepage-data
andapp-data
files will however be fetched for newest deploy. If there was webpack recompilation happening between those deploys issues might appear - such as js bundle expecting some static queries to be loaded by our loader, but they never do because newpage-data
files have different set of static queries to fetch. All of this can result in dreadful "The result of this StaticQuery could not be fetched" errors (when usinguseStaticQuery
hook) or "Loading (StaticQuery)" placeholder text (for<StaticQuery>
component).Potential solution (implemented in this PR):
webpackCompilationHash
in every html pageapp-data.json
fileapp-data.json
andpage-data.json
) were from different build and they might not be compatible. In that case try to reload (with extra step of checking if we just reloaded already to avoid infinite reload loop - if refresh didn't fix mismatch, then likely deploy in current shape is borked, so no point in trying it again and again)Related Issues
Related to #33956