dillon1000/react
Commit
Browse files Fix: Hide new/updated nodes in already hidden tree (#21929)
When a new node is added to an already hidden Offscreen tree, we need to schedule a visibility effect to hide it. Previously we would only hide when the boundary initially switches from visible to hidden, which meant that newly inserted nodes would be visible. We need to do the same thing for nodes that are updated, because the update might affect the DOM node's `style.display` property. The implementation is to check the `subtreeFlags` for an Insertion or Update effect. This only affects Offscreen, not Suspense, because Suspense boundaries cannot be updated while in their fallback (hidden) state. And it only affects mutation mode, because in persistent mode we implement hiding by cloning the host tree during the complete phase, which already happens on every update.
Changed paths3 files
First-parent comparisonpackages/react-reconciler/src/ReactFiberCompleteWork.new.js ModifiedM packages/react-reconciler/src/ReactFiberCompleteWork.old.js ModifiedM packages/react-reconciler/src/__tests__/ReactOffscreen-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…