-
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
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES is broken for static queries #22641
Comments
CC @pieh |
Per https://www.gatsbyjs.org/docs/build-caching/
So if you selectively remove parts of cached state / artificats your cache is no longer consistent and is bound to break. Just btw. regular |
@pieh Maybe I'm misunderstanding the experimental flag. Based on https://www.gatsbyjs.org/docs/page-build-optimizations-for-incremental-data-changes/ it sounded to me like the intention was to use this in CI and the only need to persist anything would be the redux files:
Are you suggesting the entire .cache and public directory needs to be persisted across builds? I was trying to replicate a CI scenario where you'd selectively persist only the redux state files and build the site inside a docker container. |
Ah, the documentation on https://www.gatsbyjs.org/docs/page-build-optimizations-for-incremental-data-changes/ need to be reworded. It is how the feature works (using persisted |
@pieh Ah, got it - this can probably be closed then. Is there any long-term plan for being able to do incremental builds without having to keep those directories (or is there a recommended approach if you are building inside of a docker container inside CI and have multiple environments you're building?) |
There are no plans like that right now. There are some build artefacts outputted directly to We could probably add nicer error messages explaining this, but I don't think we can make drastic change here. |
Thanks for your help! |
Description
When running
gatsby build
withGATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true
, an error is thrown if anything is usinguseStaticQuery
.Sample error:
Steps to reproduce
Sample project (which is just a project initialized with
gatsby new
: https://github.com/TAGraves/gatsby-incremental-exampleFirst, run:
which should output
Then, remove everything from
.cache
andpublic
other than.cache/redux
:Then run
gatsby build
again:Expected result
gatsby build
should complete showing no new, updated, or deleted pages.Actual result
gatsby build
fails with an error likeEnvironment
If you remove all the static queries from the components, the command runs successfully and has the expected behavior.
Tagging @dominicfallows since they built this feature. I do wonder if this is related to #21555 since the PR and documentation around GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES mention the old redux.state file rather than the new redux directory. Thanks friends!
The text was updated successfully, but these errors were encountered: