Add failing test to demonstrate interleaving issue with Suspense #16632
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cc/ @acdlite, as suggested on this twitter thread https://twitter.com/acdlite/status/1167531547508953088
There's a race condition that can happen on both Concurrent and Batched Modes Suspense where it's possible for all pending thenables to settle between the
commitRoot
continuation being yielded and it actually getting invoked, asshouldYieldToHost
might returntrue
if it ran out of frame time budget during the lastperformUnitOfWork
iteration. This causes all of theretryTimedOutBoundary
->scheduleCallbackForRoot
invocations to find a pre-existingImmediate
callback already queued, and so no notifications are scheduled at all.This is not really something that can be simulated on the mock scheduler (or I didn't find out how to), so it was brute-forced by inserting an intermediate continuation between
workLoop
andcommitRoot
.