dillon1000/react

Commit

Revert to client render on text mismatch (#23354)

* Refactor warnForTextDifference

We're going to fork the behavior of this function between concurrent
roots and legacy roots.

The legacy behavior is to warn in dev when the text mismatches during
hydration. In concurrent roots, we'll log a recoverable error and revert
to client rendering. That means this is no longer a development-only
function — it affects the prod behavior, too.

I haven't changed any behavior in this commit. I only rearranged the
code slightly so that the dev environment check is inside the body
instead of around the function call. I also threaded through an
isConcurrentMode argument.

* Revert to client render on text content mismatch

Expands the behavior of enableClientRenderFallbackOnHydrationMismatch to
check text content, too.

If the text is different from what was rendered on the server, we will
recover the UI by falling back to client rendering, up to the nearest
Suspense boundary.
Browse files
Changed paths7 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js ModifiedM packages/react-dom/src/client/ReactDOMComponent.js ModifiedM packages/react-dom/src/client/ReactDOMHostConfig.js ModifiedM packages/react-reconciler/src/ReactFiberHydrationContext.new.js ModifiedM packages/react-reconciler/src/ReactFiberHydrationContext.old.js ModifiedM packages/react-reconciler/src/__tests__/useMutableSourceHydration-test.js ModifiedM scripts/error-codes/codes.json Modified
Patch

Files changed

Rendering syntax-highlighted changes…