-
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: clear tracked queries when deleting stale page-data files #29431
Conversation
if (!expectedPageDataFiles.has(pageDataFilePath)) { | ||
const stalePageDataContent = await fs.readJson(pageDataFilePath) |
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.
this adds fs
operation - but just for page-data files that are marked as stale and scheduled for deletion. This is to grab page.path
.
Alternatively we could try to derive page.path
from location of page-data
file, but this is not deterministic due to all the variations of leading and trailing slashes ... and it also would be more convoluted.
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.
A nice trick to get this path! 😄
Danger run resulted in 1 fail and 1 markdown; to find out more, see the checks page. Generated by 🚫 dangerJS |
* fix(gatsby): add pages to saved redux state * chore: update test snapshots * unskip context change scenario for data tracking tests * mock Date.now so persistance tests don't rely on actual time (needed for updatedAt and snapshot testing) * refactor persistance tests a bit to allow for creating different pages per test scenario * shard pages state (on top of existing sharding for nodes) * drop page count check (there actually might be valid cases for 0 pages) * only show page context size warning for pages (and not nodes) * fix lint * adjust snapshot * test(artifacts): add case for changing page context * fix(gatsby): garbage collect stateful pages (#28760) * add stateful page to artifacts tests * fix(gatsby): garbage collect stateful pages * Revert "fix: clear tracked queries when deleting stale page-data files (#29431)" (#30848) This reverts commit 478cf68. Co-authored-by: Reda Bacha <mohamedredabacha@hollandandbarrett.com>
Description
Deleting stale page-data files from previous builds doesn't clean up our query tracking state. This can result in following kind of errors at SSG step:
It can be reproduced by conditionally adding/removing page between builds where we wouldn't clear cache in between runs:
queries
reducer will still keep track of itNote - this is more of a hot fix. Proper fix #28590 and #28760 (as in persisting pages to be able to rely on already existing
DELETE_PAGE
action handler inqueries
reducer (which just doesn't happen right now because pages are not persisted)