-
-
Notifications
You must be signed in to change notification settings - Fork 167
fix: fouc in website #1568
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: fouc in website #1568
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
commit: |
...headElements.filter((ele) => ele.props?.async !== true), | ||
// See: https://github.com/wakujs/waku/pull/1545 | ||
// isolate `React.use` in its own component | ||
// https://github.com/facebook/react/issues/33937#issuecomment-3091349011 | ||
createElement(async () => { | ||
const resolvedHtmlNode = await htmlNode; | ||
return createElement(HtmlNodeWrapper, null, resolvedHtmlNode); | ||
}), | ||
...headElements, | ||
...headElements.filter((ele) => ele.props?.async === true), |
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.
why are these added separately?
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.
I believe it will have some performance improvement when putting sync script on top. and async script won't be ran immediately
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.
It seems like some head elements should come before to avoid FOUC and some should come after to avoid hydration mismatch errors.
There's a FOUC regression. It's caused by my change in #1514.
This feels like an ad-hoc fix. I wonder if #1493 fixes completely.