-
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): fix hydration flicker on initial render of ssr page #33134
Conversation
a128345
to
bdf42b5
Compare
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.
Nice! I was about to push a fix for this. Thank you for doing this!
let hasPageData = false | ||
if (pages.size) { | ||
// test if 1 page-data file exists, if it does we know we're on a gatsby version that supports page-data | ||
const pageDataPath = publicFolder( | ||
getPageDataPath(pages.get(pages.keys().next().value).path) | ||
) | ||
hasPageData = existsSync(pageDataPath) | ||
} | ||
|
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 heuristic is no longer working as intended with non-ssg pages and it was there to support really old gatsby version (early v2?)
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.
Indeed
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.
Thank you!
…sbyjs#33134) * inline page-data object in html when it contains serverData * skip settting page-data preload link header for ssr pages
Description
This fixes essentially running
getServerData
twice for same page (once for html and once for page-data) by inlining page-data in html response and hydrating pageData cache so that we never even need page-data requestNote
This will require also Link headers to be not be there for
page-data
file whengetServerData
is used