[Fiber] Trigger default transition indicator if needed #33160
+413
−5
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.
This implements
onDefaultTransitionIndicator
.The sequence is:
markRootUpdated
we schedule Transition updates as needingindicatorLanes
on the root. This tracks the lanes that currently need an indicator to either start or remain going until this lane commits.currentEventTransitionLane
. This requires that the lane is still active while we do these commits. See Reset currentEventTransitionLane after flushing sync work #33159. In other words, a sync update gets associated with the current transition and it is assumed to be rendering the loading state for that corresponding transition so we don't need a default indicator for this lane.processRootScheduleInMicrotask
, right before we're about to enter a new "event transition lane" scope, it is no longer possible to render any more loading states for the current transition lane. That's when we invokeonDefaultTransitionIndicator
for any roots that have new indicator lanes.indicatorLanes
and once that reaches zero again, then we can clean up the default indicator. This approach means that you can start multiple different transitions while an indicator is still going but it won't stop/restart each time. Instead, it'll wait until all are done before stopping.Follow ups:
useDeferredValue
. Since it also goes throughmarkRootUpdated
and schedules a Transition lane it'll get a default indicator even though it probably shouldn't have one.