Repository navigation
Conversation
|
Hi @gamgsp! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
The build for this commit did not complete, so there is no size report. See the workflow run for details. Generated by sizebot against 9841e22 |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Fixes #37620
Summary
Preserves the painted SSR Suspense fallback DOM nodes when client hydration suspends again on a client-created promise (e.g.
use(browser())followed by Web APIs likelocalStorage,IndexedDB, or client timers).Background
On full page load with React 19 / Fizz, when a component triggers a recoverable browser bailout, Fizz flushes the painted
<Suspense>fallback into HTML.During client hydration, when the component re-suspends on a client-only promise, React previously entered
mountSuspenseFallbackAfterRetryWithoutHydrating, deleting the server-rendered fallback and mounting an identical client fallback. This drops existing DOM state and abruptly restarts CSS animations (such as progress bars and skeleton loaders).Solution
DehydratedFragment:updateDehydratedSuspenseComponent, when a boundary has a recoverable digest (REACT_RECOVERABLE_DIGEST) and a validDehydratedFragment, remove the fragment fromworkInProgress.deletionsinstead of queuing it for deletion.DehydratedFragmentas the sibling of the hidden offscreen primary child.updateSuspenseFallbackChildrenandupdateSuspenseComponent, handlefallbackChildFragment.tag === DehydratedFragmentso the live DOM is left intact without re-invoking or cloning fallback children.Testing
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.jsvalidating:span) stay strictly identical across client hydration.