dillon1000/react

Commit

Clear extra nodes if there's a hydration mismatch within a suspense boundary (#22592)

* Clear extra nodes if there's a mismatch within a suspense boundary

This usually happens when we exit out a DOM node but a suspense boundary
is a virtual DOM node and we didn't do it in that case because we took a
short cut by calling resetHydrationState directly since we know we won't
need to pop.

* Tighten up the types of getFirstHydratableChild

We currently call getFirstHydratableChild to step into the children of
a suspense boundary. This can be a text node or a suspense boundary
which isn't compatible with getFirstHydratableChild, and we cheat the type.

This accidentally works because .firstChild always returns null on those
nodes in the DOM.

This just makes that explicit.
Browse files
Changed paths6 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js ModifiedM packages/react-dom/src/client/ReactDOMHostConfig.js ModifiedM packages/react-reconciler/src/ReactFiberCompleteWork.new.js ModifiedM packages/react-reconciler/src/ReactFiberCompleteWork.old.js ModifiedM packages/react-reconciler/src/ReactFiberHydrationContext.new.js ModifiedM packages/react-reconciler/src/ReactFiberHydrationContext.old.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…