Skip to content

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Jul 30, 2025

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.

Copy link

vercel bot commented Jul 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Jul 30, 2025 0:55am
Copy link

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.

Copy link

pkg-pr-new bot commented Jul 30, 2025

Open in StackBlitz

npm i https://pkg.pr.new/wakujs/waku@1568

commit: e94fb65

@dai-shi dai-shi marked this pull request as ready for review July 30, 2025 13:25
Comment on lines +167 to +175
...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),
Copy link
Member

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?

Copy link
Member

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

Copy link
Member Author

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.

@himself65 himself65 merged commit 62c1fe2 into main Jul 30, 2025
88 of 91 checks passed
@dai-shi dai-shi deleted the fix/fouc branch July 30, 2025 23:21
@dai-shi dai-shi mentioned this pull request Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants