Repository navigation
Description
On full page load, a client component calls use(browser()) (Suspense fallback is in the SSR HTML), then use() with a promise made on the client. On hydration the fallback remounts and the Progress animation starts again, even though loading is not done.
We hit this on /client-promise. Repro uses a client window.setTimeout promise after use(browser()). Real usage is the same shape when loading with Web APIs (for example localStorage, IndexedDB, or other window APIs).
/loading-only (same Progress, not a Suspense fallback) and /server-promise (promise from the server) do not restart.
Related earlier PR: #24236 (reverted in #24434).
React version: 19.3.0 (Next.js 16.3.4)
Steps To Reproduce
- Open https://suspense-fallback-hydration-reset.vercel.app/client-promise in the address bar (full page load).
- In DevTools: Disable cache, set CPU to 4x slowdown. Hard refresh. The Progress bar jumps back near hydration.
- Hard refresh https://suspense-fallback-hydration-reset.vercel.app/server-promise and https://suspense-fallback-hydration-reset.vercel.app/loading-only. The animation does not jump on those pages.
Link to code example:
https://suspense-fallback-hydration-reset.vercel.app/
https://github.com/michaltarasiuk/suspense-progress-hydration-reset
"use client";
import { use, Suspense } from "react";
import { browser } from "react-dom";
let p: Promise<number> | undefined;
function getClientPromise() {
p ??= new Promise((r) => window.setTimeout(() => r(1), 3000));
return p;
}
function ClientPromise() {
use(browser());
use(getClientPromise());
return <div>Loaded</div>;
}
export default function Page() {
return (
<Suspense fallback={<Loading />}>
<ClientPromise />
</Suspense>
);
}The current behavior
The SSR fallback remounts on hydration. The Progress animation starts again.
The expected behavior
The SSR fallback stays mounted on hydration. The animation runs without restart until loading finishes.
Activity
michaltarasiuk commentedon Sep 13, 2026
The
browser()docs describe this same path for a Suspense-enabled data-fetching library:From the docs: with
initialData, React renders on the server; without it, React leaves the closest Suspense fallback in the HTML. In the browser,useQuerycan fetch the data or read it from its client cache.https://react.dev/reference/react-dom/browser#conditionally-rendering-on-the-server
This repro uses a cached
window.setTimeoutpromise in place of that client fetch, only to keep the demo small. The sequence is the same: the SSR fallback is already painted, hydration runs, the boundary suspends again on the client, and the fallback remounts.bountyhub-bot commentedon Sep 15, 2026
🚀 Bounty Alert!
💰 A bounty of $100.00 has been created by devlootxyz-bounties on BountyHub for this issue.
🔗 Claim this bounty by submitting a pull request that solves this issue!
You can also increase the amount of the bounty if you think the issue is worth more.
Good luck, and happy coding! 💻
Yeshwanth-develops commentedon Sep 16, 2026
Root Cause Analysis
The fallback remounting occurs due to how React transitions a dehydrated Suspense boundary from server-rendered fallback mode to client retry mode when primary children suspend during hydration retry.
1. Server Phase (Fizz)
use(browser())during SSR,ReactFizzHooksthrows a recoverable error branded withREACT_RECOVERABLE_TYPE.<Suspense>boundary catches this error and outputs a dehydrated fallback boundary marked withREACT_RECOVERABLE_DIGEST(<!--$!--><template data-dgst=""></template>...fallback markup...<!--/$-->).2. Initial Hydration Pass
mountDehydratedSuspenseComponentchecksisSuspenseInstanceFallback(suspenseInstance).memoizedState = { dehydrated: suspenseInstance, ... }and schedules aDefaultLaneupdate to retry rendering the primary tree on the client.3. Hydration Retry Pass (
retrySuspenseComponentWithoutHydrating)DefaultLanetask runs,updateDehydratedSuspenseComponentseesisSuspenseInstanceFallback(...)and invokesretrySuspenseComponentWithoutHydrating:current.child(the fiber pointing to the dehydrated fallback DOM).workInProgress.memoizedState = nullto indicate that this boundary is no longer dehydrated.mountSuspensePrimaryChildren).4. The Client Suspend & Second Pass Remount
When rendering
<ClientPromise />:use(browser())returnsundefined(safe no-op on the client).use(getClientPromise())suspends on the client promise.React catches the suspended promise and enters the second pass in
updateDehydratedSuspenseComponent:vidhi-0205 commentedon Sep 16, 2026
Hi @michaltarasiuk ,
I’d like to work on this bounty. I’ve reviewed the reproduction steps and understand that the issue is related to the Suspense fallback being remounted during hydration when a client component first suspends with
use(browser())and then suspends on a client-created promise.I’ll investigate the hydration/Suspense behavior, reproduce the issue against the relevant React version, identify the cause, and implement a focused fix with appropriate regression coverage. I’ll also verify the behavior against the existing
/client-promise,/server-promise, and/loading-onlycases to make sure the fix doesn’t introduce regressions.I’ll do the implementation and debugging myself, using AI only as an assistance tool where appropriate, in accordance with the bounty requirements.
I’m interested in taking this up. Please let me know if there are any additional constraints or preferred testing requirements.
michaltarasiuk commentedon Sep 16, 2026
Hi @vidhi-0205,
I didn't report the bounty.
ayushman1210 commentedon Sep 24, 2026
Hey @michaltarasiuk is this issue currently opens up ? I would like like to work on this issue please /assign it to me thanks !!
theworker02 commentedon Sep 26, 2026
/claim
Claiming the $100 BountyHub bounty as theworker02.
Plan:
theworker02 commentedon Sep 26, 2026
Opened PR with the fix + regression coverage: #37694
Verified locally: yarn test ReactDOMFizzServer-test (browser-only / remount patterns) - 7 passed.
sidshehria commentedon Sep 28, 2026
/claim
Claiming the
$100BountyHub bounty as sidshehria.Opened PR with the fix + regression coverage: #37705
Verified locally:
yarn test --build=false ReactDOMFizzServer-test(browser-only / remount patterns) — 7 passed.Don't keep the server fallback if the content spawned a deferred render
Merge upstream main into react#37620 fix
akshaysirimisetti940-pixel commentedon Oct 15, 2026
Hi, I'm interested in contributing a fix for this issue.
Before I start working on it, could you please clarify whether the $100 BountyHub bounty is active and what the eligibility and payout requirements are?
I also noticed existing related PRs. Could you confirm whether a new contribution is still needed and what specific work remains?
Thank you!
1132dadf commentedon Oct 18, 2026
I claim this $100 bounty! Will fix the Suspense hydration fallback remount bug and submit PR within 72h.
Fix react#37620: preserve SSR Suspense fallback in ReactFiberBeginWork
Fix react#37620: bubble properties for preserved dehydrated fragment …
Fix react#37620: add regression tests for preserved SSR fallback in R…
9xj89gzrtw-hue commentedon Oct 22, 2026
Claiming the
$100BountyHub bounty.Opened a fix: #37966 — Preserve painted SSR fallback DOM when hydration suspends again on a recoverable boundary.
Key points vs. the root cause:
DehydratedFragmentfallback and mounts an identical client-rendered fallback, restarting CSS-driven animations (and in some orderings hands raw tag 18 to the work loop →Unknown unit of work tag (18)).ReactFiberBeginWork.js.Evidence: new end-to-end test — SSR paints the fallback, hydration suspends on both a
browser()resource and a client promise, the fallback DOM node keeps its identity throughout, and content swaps in after the promise resolves. Full suite (185/185) + reconciler Suspense suites + Flow pass; competitors' crash path (Unknown unit of work tag (18)) is covered by the same suite.Wallet for the bounty payout (Base USDC):
0xbbe6966949d7265a7f5f0b793f08293b9b7fe926fix(react-reconciler): preserve painted SSR Suspense fallback on clie…
MilindChatrabhuji commentedon Oct 28, 2026
/claim
Claiming the BountyHub bounty as MilindChatrabhuji.
Fix submitted in PR #38026: #38026 (branch ix/suspense-fallback-hydration-remount-37620).
Root Cause & Implementation Summary
When a Suspense boundary outputs a recoverable fallback during SSR (e.g. use(ReactDOM.browser()) bailout with REACT_RECOVERABLE_DIGEST), the server-rendered fallback DOM is painted and visible. If the component subsequently suspends again on the client (e.g. use(clientPromise)), the previous hydration retry fell through to mountSuspenseFallbackAfterRetryWithoutHydrating, deleting the painted DehydratedFragment fallback fiber and mounting a new client fallback, which resets DOM state and restarts CSS spinner animations.
PR #38026 resolves this cleanly:
ull.
michaltarasiuk commentedon Oct 28, 2026
Hi, please stop claiming the bounty. I am not the creator of it. Also, stop creating multiple duplicate, AI-generated PRs.
1132dadf commentedon Oct 28, 2026
transmogrify-cell commentedon Nov 9, 2026
@devlootxyz-bounties
I looked into this and opened #38174, which adds tests only (no fix). Findings, in case they help triage:
Confirmed, and not specific to
browser(). A<!--$!-->boundary is retried as a client render during hydration. If that retry suspends,updateDehydratedSuspenseComponentcallsmountSuspenseFallbackAfterRetryWithoutHydrating, which deletes the server fallback and inserts a new one. Onmain(b05c0b7), the fallback node gets replaced in all three cases that produce a client-rendered boundary:use(browser())followed by a client suspend (this issue)abort(browser())followed by a client suspend (the timeout example in thebrowser()docs)This is the behavior #24236 changed in 2022 and #24434 reverted. The revert was for a late-mutations regression at Meta, cause unknown. #24236's tests are still on
mainas@gate FIXMEinReactDOMFizzServer-test.js: "does not recreate the fallback if server errors and hydration suspends" and the two tests after it. So the expected behavior is already specified. What's missing is a fix that doesn't bring back that regression. #38174 adds thebrowser()version of that@gate FIXMEtest, plus a passing test that newfallbackprops still render while the client retry is suspended.Repro measurements. Headless Chrome 157, cache disabled, React
19.3.0-canary-cbb046ab-20260731(the version Next 16.3.4 bundles). I used a MutationObserver installed before any page script ran./client-promise: during hydration the SSR[role=progressbar]node is removed and a new node is inserted. At 20x CPU slowdown, the indicator's animationcurrentTimedrops from 717 ms to 0./server-promise: the SSR node stays until the content arrives./loading-only: the SSR node is never replaced.Open PRs. #37705 is line-for-line identical to #37694, and #38026 to #37966. I applied each distinct patch on
main. Both keep the server fallback node in the twobrowser()cases above, but:browser()digest, so the server-error case is unchanged and the@gate FIXMEtests still fail.<button onClick>in the fallback gets 0 calls (1 onmain).fallbackprop while suspended are ignored. The fallback keeps showing "Loading..." wheremainrenders the new text. This is the case the third FIXME test covers.Possible workaround until this is fixed. Move the indicator out of the boundary, so it hydrates as normal content, and give the boundary an empty fallback:
In a React DOM test on
main, the server-rendered indicator keeps the same DOM node through hydration, no recoverable errors are reported, and the indicator is removed once the content mounts. I haven't run it in your Next app.Keep the server fallback when a client-rendered boundary suspends
transmogrify-cell commentedon Nov 10, 2026
Update: #38174 now has a fix on top of the tests.
If the client render of a
<!--$!-->boundary suspends on data and the boundary hasn't received new props or a context change, it stays dehydrated and keeps the server fallback until the data resolves, instead of mounting a new one. That coversbrowser(),abort()and server errors. It's scoped to the boundary, so unlike #24236 it doesn't hold back the root's commit. The server error is still reported at the same point as before, and only once.Two limitations:
Two of the old
@gate FIXMEtests from #24236 pass now. The transition one stays gated, since I didn't want to block transitions until client data loads. I haven't been able to run it in your Next app, so if you get a chance to try it against your repro, I'd like to hear how it goes.Preserve SSR Suspense fallback across client re-suspend (react#37620)