MCPcopy
hub / github.com/plotly/dash / updateSuspenseFallbackChildren

Function updateSuspenseFallbackChildren

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

Source from the content-addressed store, hash-verified

20492 }
20493
20494 function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) {
20495 var mode = workInProgress.mode;
20496 var currentPrimaryChildFragment = current.child;
20497 var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
20498 var primaryChildProps = {
20499 mode: 'hidden',
20500 children: primaryChildren
20501 };
20502 var primaryChildFragment;
20503
20504 if ( // In legacy mode, we commit the primary tree as if it successfully
20505 // completed, even though it's in an inconsistent state.
20506 (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
20507 // already cloned. In legacy mode, the only case where this isn't true is
20508 // when DevTools forces us to display a fallback; we skip the first render
20509 // pass entirely and go straight to rendering the fallback. (In Concurrent
20510 // Mode, SuspenseList can also trigger this scenario, but this is a legacy-
20511 // only codepath.)
20512 workInProgress.child !== currentPrimaryChildFragment) {
20513 var progressedPrimaryFragment = workInProgress.child;
20514 primaryChildFragment = progressedPrimaryFragment;
20515 primaryChildFragment.childLanes = NoLanes;
20516 primaryChildFragment.pendingProps = primaryChildProps;
20517
20518 if ( workInProgress.mode & ProfileMode) {
20519 // Reset the durations from the first pass so they aren't included in the
20520 // final amounts. This seems counterintuitive, since we're intentionally
20521 // not measuring part of the render phase, but this makes it match what we
20522 // do in Concurrent Mode.
20523 primaryChildFragment.actualDuration = 0;
20524 primaryChildFragment.actualStartTime = -1;
20525 primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
20526 primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
20527 } // The fallback fiber was added as a deletion during the first pass.
20528 // However, since we're going to remain on the fallback, we no longer want
20529 // to delete it.
20530
20531
20532 workInProgress.deletions = null;
20533 } else {
20534 primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); // Since we're reusing a current tree, we need to reuse the flags, too.
20535 // (We don't do this in legacy mode, because in legacy mode we don't re-use
20536 // the current tree; see previous branch.)
20537
20538 primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask;
20539 }
20540
20541 var fallbackChildFragment;
20542
20543 if (currentFallbackChildFragment !== null) {
20544 fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren);
20545 } else {
20546 fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
20547 // mounted but this is a new fiber.
20548
20549 fallbackChildFragment.flags |= Placement;
20550 }
20551

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…