Fix continuation bug (#31434)
## 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 <[email protected]>
R
Ricky committed
b836de613d66ff36574af95cb93ad15fd743d1f4
Parent: ed15d50
Committed by GitHub <[email protected]>
on 11/11/2024, 10:25:37 PM