-
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
What is the update schema step? #14797
Comments
In the "schema update" step, Gatsby infers the shape of the As long as you're only passing ids, slugs, or small amounts of data via Now, in most cases you will not actually need the full In the meantime you can comment out schema updating (like in the linked comment) - for a more official way we could maybe add this as a experimental flag)? |
Thanks for the reply Stefan. It turns out that we do have some pages with lots of data in the context to accommodate search. Once I commented those out, our pages were blazing fast again. We'll dig into the docs about adding search in a better way (https://www.gatsbyjs.org/docs/adding-search/) to figure out a way that would fit our needs. Adding an experimental flag may be a quicker route for us than redoing our whole search. We can take a look at that issue and then follow the contributing guidelines? https://www.gatsbyjs.org/contributing/how-to-contribute/ |
So I also just ran into this issue. Please add the flag for this let me know if you need help in contributing this change. |
@master12 We actually decided to rework our search since that would eventually break as well. In regards to the flag, our contribution may possibly be a few weeks out since we are resolving our issue by limiting the amount of data we pass through context. |
Hi all, @stefanprobst can you, please, explain why "update schema" step take much more time comparing to the version 2.0.117, for example? Cause, our project migrated from 2.0.117 to 2.9.0 and the difference in "update schema" step is enormous. |
@VikLiegostaiev Sorry for the late reply. The fact that schema updating can take a lot longer has to do with the Schema Customization API introduced in Gatsby v2.2. In particular, schema inference previously only checked on a random string field value if it is a Date (or a File path) and set the field type in the schema accordingly. Since v2.2 we do this more consistently by not only checking one field value. Especially in cases where you try to pass a lot of data (with a lot of string values) down via context, this has a perf impact. everybody // gatsby-node.js
// Alternatively use `exports.sourceNodes` API for v2.11 and below
exports.createSchemaCustomization = ({ actions }) => {
actions.createTypes(`
type SitePage implements Node @dontInfer {
path: String!
}
`)
} |
I'm going to close this as answered, but don't hesitate to ask if anything needs further clarification! |
@stefanprobst Hi |
hi @VikLiegostaiev |
Actually We too ran into this same issue. But the problem is we were in need of all the data that has been passed through the context. So we thought instead of sending large json as objects to context we stringified it and parsed it at the page. And yes. It worked like a charm. Hope this would help |
@j6workz thanks for advice, we will check. Seems to be very simple and very affective solution :-) |
Summary
We are in the process of upgrading our project from 2.1.23 to 2.9.4. Everything is going well except the
update schema
step is taking several minutes to complete. While trying to find solutions to this issue, we stumbled upon #12692 (comment). The issue says that we could "disable" this step if we don't need the context. I guess I don't understand what this step does and how we can disable it. I tried to comment it out in the source code when we build to see how the step affects our website but I don't see any differences except for our build is dramatically faster. Our questions are:Relevant information
Below is a log from us running
GATSBY_ENV=development node --max-old-space-size=4096 ./node_modules/.bin/gatsby develop -p 4000
Other interesting info about our build
gatsby-image
on many of our images that are hosted on contentful and on images that are queried through static queries@gatsby-contrib/gatsby-plugin-elasticlunr-search
and the search index is pretty largeEnvironment (if relevant)
File contents (if changed)
All of these files are pretty heavily updated and contains some proprietary content. Will summarize our changes below or add files that have config information removed from them.
gatsby-config.js
:package.json
: N/Agatsby-node.js
: For all of our pages not built from contentful, we build them all in this file. We do not use the default pages(?) folder to build our pages. We call thecreatePage
function to generate our entire site.gatsby-browser.js
: Redux setup and other 3rd party component setup. Pretty identical to gatsby-ssrgatsby-ssr.js
: Redux setup and other 3rd party component setup. Pretty identical to gatsby-browserThe text was updated successfully, but these errors were encountered: