dillon1000/react

Commit

Fix ViewTransition null stateNode with SuspenseList (#35520)

I was experimenting with animations in SuspenseList and hit a crash
using ViewTransition as a direct child with `revealOrder="together"`

```
    TypeError: Cannot read properties of null (reading 'autoName')

      33 |     return props.name;
      34 |   }
    > 35 |   if (instance.autoName !== null) {
         |                ^
      36 |     return instance.autoName;
      37 |   }
```

When ViewTransition is direct child of SuspenseList, the second render
pass calls resetChildFibers, setting stateNode to null. Other fibers
create stateNode in completeWork. ViewTransition does not, so stateNode
is lost.

Followed the pattern used for Offscreen to update stateNode in beginWork
if it is null.

Also added a regression test.
Browse files
Changed paths2 files
First-parent comparison
A packages/react-dom/src/__tests__/ReactDOMViewTransition-test.js AddedM packages/react-reconciler/src/ReactFiberBeginWork.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…