dillon1000/react

Commit

Fix: Infinite act loop caused by wrong shouldYield (#26317)

Based on a bug report from @bvaughn.

`act` should not consult `shouldYield` when it's performing work,
because in a unit testing environment, I/O (such as `setTimeout`) is
likely mocked. So the result of `shouldYield` can't be trusted.

In the regression test, I simulate the bug by mocking `shouldYield` to
always return `true`. This causes an infinite loop in `act`, because it
will keep trying to render and React will keep yielding.
Browse files
Changed paths2 files
First-parent comparison
M packages/react-reconciler/src/ReactFiberWorkLoop.js ModifiedM packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…