chore(gatsby-admin): fix built html not having layout wrappers #26355
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.
We have a
wrapPageElement
method in gatsby-browser.js that wraps every page in our<Layout />
component, which adds some global styling and wraps the page in all kinds of context providers—most notably, the theme providers!So far, that worked fine and looked alright. However, we started using some gatsby-interface components that rely on the theme being in the context during
gatsby build
. That suddenly broke the build process with errors such as this and this, yet the develop process kept working fine.I realised this morning that the fix is as simple as also adding the
wrapPageElement
to gatsby-ssr.js! 🤦 This unblocks #26195 and #26243.