Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Jul 21, 2025

@hi-ogawa hi-ogawa changed the title fix: mention React.use SSR bug workaround fix: add React.use SSR bug workaround Jul 21, 2025
@hi-ogawa hi-ogawa changed the title fix: add React.use SSR bug workaround fix: add React.use SSR bug workaround Jul 21, 2025
@pawelblaszczyk5
Copy link

Oh, so that's what I was experiencing lately 😄 I was surprised by some weird behavior where promise resolved to a different value for a moment. However, it seems for me that this fix doesn't solve the issue? https://github.com/pawelblaszczyk5/vite-rsc-experiments/tree/main/apps/error-boundary

Do you have any ideas?

Also, surprised a bit by difference between experimental/canary - it's fixed in React experimental channel for me, but broken in canary.

@hi-ogawa
Copy link
Contributor Author

hi-ogawa commented Jul 22, 2025

There is async in the wrapper and this doesn't serve as a workaround since we are trying to eliminate React's internal thenable state (which kicks in either use or async/await component) https://github.com/pawelblaszczyk5/vite-rsc-experiments/blob/0112085c32c87674a1949e42d662f3e94b499392/apps/error-boundary/src/framework/entry.ssr.tsx#L11

This should be simply:

const SsrUseWorkaround = (props: React.PropsWithChildren) => props.children;

The original React issue facebook/react#33937 reproduces on all channels. Though there might be some variance on how it reproduces depending on component tree and maybe some scheduling, I think the underlying issue is on React.

@hi-ogawa hi-ogawa changed the title fix: add React.use SSR bug workaround chore(rsc): add SSR thenable workaround in starter Jul 22, 2025
@hi-ogawa hi-ogawa marked this pull request as ready for review July 22, 2025 01:57
@hi-ogawa hi-ogawa changed the title chore(rsc): add SSR thenable workaround in starter test(rsc): add SSR thenable workaround in examples Jul 22, 2025
@hi-ogawa hi-ogawa merged commit bfd434f into main Jul 22, 2025
19 checks passed
@hi-ogawa hi-ogawa deleted the 07-21-fix_mention_react.use_ssr_bug_workaround branch July 22, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants