From 3a5b326d8180f005a10e34a07ded6d5632efe337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Tue, 13 May 2025 16:10:28 -0400 Subject: [PATCH] [Fiber] Trigger default indicator for isomorphic async actions with no root associated (#33190) Stacked on #33160, #33162, #33186 and #33188. We have a special case that's awkward for default indicators. When you start a new async Transition from `React.startTransition` then there's not yet any associated root with the Transition because you haven't necessarily `setState` on anything yet until the promise resolves. That's what `entangleAsyncAction` handles by creating a lane that everything entangles with until all async actions are done. If there are no sync updates before the end of the event, we should trigger a default indicator until either the async action completes without update or if it gets entangled with some roots we should keep it going until those roots are done. --- .../view-transition/src/components/Page.js | 2 +- .../src/ReactFiberAsyncAction.js | 102 +++++++++++++- .../src/ReactFiberReconciler.js | 7 +- .../src/ReactFiberRootScheduler.js | 56 +++++--- .../ReactDefaultTransitionIndicator-test.js | 127 +++++++++++++++++- 5 files changed, 274 insertions(+), 20 deletions(-) diff --git a/fixtures/view-transition/src/components/Page.js b/fixtures/view-transition/src/components/Page.js index d7f7bc0983..db2cd0aff0 100644 --- a/fixtures/view-transition/src/components/Page.js +++ b/fixtures/view-transition/src/components/Page.js @@ -113,8 +113,8 @@ export default function Page({url, navigate}) {