dillon1000/react

Commit

Bugfix: Selective hydration triggers false update loop error (#27439)

This adds a regression test and fix for a case where a sync update
triggers selective hydration, which then leads to a "Maximum update
depth exceeded" error, even though there was only a single update. This
happens when a single sync update flows into many sibling dehydrated
Suspense boundaries.

This fix is, if a commit was the result of selective hydration, we
should not increment the nested update count, because those renders
conceptually are not updates.

Ideally, they wouldn't even be in a separate commit — we should be able
to hydrate a tree and apply an update on top of it within the same
render phase. We could do this once we implement resumable context
stacks.
Browse files
Changed paths3 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js ModifiedM packages/react-reconciler/src/ReactFiberLane.js ModifiedM packages/react-reconciler/src/ReactFiberWorkLoop.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…