MCPcopy Create free account
hub / github.com/plotly/dash / updateSuspenseFallbackChildren

Function updateSuspenseFallbackChildren

dash/deps/react-dom@18.3.1.js:20533–20596  ·  view source on GitHub ↗
(current, workInProgress, primaryChildren, fallbackChildren, renderLanes)

Source from the content-addressed store, hash-verified

20531 }
20532
20533 function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) {
20534 var mode = workInProgress.mode;
20535 var currentPrimaryChildFragment = current.child;
20536 var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
20537 var primaryChildProps = {
20538 mode: 'hidden',
20539 children: primaryChildren
20540 };
20541 var primaryChildFragment;
20542
20543 if ( // In legacy mode, we commit the primary tree as if it successfully
20544 // completed, even though it's in an inconsistent state.
20545 (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
20546 // already cloned. In legacy mode, the only case where this isn't true is
20547 // when DevTools forces us to display a fallback; we skip the first render
20548 // pass entirely and go straight to rendering the fallback. (In Concurrent
20549 // Mode, SuspenseList can also trigger this scenario, but this is a legacy-
20550 // only codepath.)
20551 workInProgress.child !== currentPrimaryChildFragment) {
20552 var progressedPrimaryFragment = workInProgress.child;
20553 primaryChildFragment = progressedPrimaryFragment;
20554 primaryChildFragment.childLanes = NoLanes;
20555 primaryChildFragment.pendingProps = primaryChildProps;
20556
20557 if ( workInProgress.mode & ProfileMode) {
20558 // Reset the durations from the first pass so they aren't included in the
20559 // final amounts. This seems counterintuitive, since we're intentionally
20560 // not measuring part of the render phase, but this makes it match what we
20561 // do in Concurrent Mode.
20562 primaryChildFragment.actualDuration = 0;
20563 primaryChildFragment.actualStartTime = -1;
20564 primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
20565 primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
20566 } // The fallback fiber was added as a deletion during the first pass.
20567 // However, since we're going to remain on the fallback, we no longer want
20568 // to delete it.
20569
20570
20571 workInProgress.deletions = null;
20572 } else {
20573 primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); // Since we're reusing a current tree, we need to reuse the flags, too.
20574 // (We don't do this in legacy mode, because in legacy mode we don't re-use
20575 // the current tree; see previous branch.)
20576
20577 primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask;
20578 }
20579
20580 var fallbackChildFragment;
20581
20582 if (currentFallbackChildFragment !== null) {
20583 fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren);
20584 } else {
20585 fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
20586 // mounted but this is a new fiber.
20587
20588 fallbackChildFragment.flags |= Placement;
20589 }
20590

Callers 1

updateSuspenseComponentFunction · 0.70

Calls 3

createWorkInProgressFunction · 0.70
createFiberFromFragmentFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…