mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
a6bc139e0e0ca6a44d24ebdcb70fb4ef01150888
## Overview
In `scheduleTaskForRootDuringMicrotask` we clear `root.callbackNode` if
the work loop is [suspended waiting on
data](https://github.com/facebook/react/blob/ac3ca097aeecae8fe3ec7f9b286307a923676518/packages/react-reconciler/src/ReactFiberRootScheduler.js#L338).
But we don't null check `root.callbackNode` before returning a
continuation in `performWorkOnRootViaSchedulerTask` where
`scheduleTaskForRootDuringMicrotask` is synchronously called, causing an
infinite loop when the only thing in the queue is something suspended
waiting on data.
This essentially restores the behavior from here:
https://github.com/facebook/react/pull/26328/files#diff-72ff2175ae3569037f0b16802a41b0cda2b2d66bb97f2bda78ed8445ed487b58L1168
Found by investigating the failures for
https://github.com/facebook/react/pull/31417
## TODO
- add a test
---------
Co-authored-by: Joe Savona <joesavona@fb.com>
DiffTrain build for [b836de613d](https://github.com/facebook/react/commit/b836de613d66ff36574af95cb93ad15fd743d1f4)
react-fbsource-import
Description
Languages
JavaScript
67.1%
TypeScript
29.4%
HTML
1.5%
CSS
1.1%
C++
0.6%
Other
0.2%