updateSuspenseFallbackChildren() — react Function Reference
Architecture documentation for the updateSuspenseFallbackChildren() function in ReactFiberBeginWork.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD cff6838d_8fc0_b94c_3dcd_2def67940837["updateSuspenseFallbackChildren()"] 0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"] cff6838d_8fc0_b94c_3dcd_2def67940837 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c f4acdab6_f680_af63_8940_0259a68c2f48["updateSuspenseComponent()"] f4acdab6_f680_af63_8940_0259a68c2f48 -->|calls| cff6838d_8fc0_b94c_3dcd_2def67940837 34d657a1_f8c8_f0b5_e2d8_cba9518e0da2["updateWorkInProgressOffscreenFiber()"] cff6838d_8fc0_b94c_3dcd_2def67940837 -->|calls| 34d657a1_f8c8_f0b5_e2d8_cba9518e0da2 219a3239_d833_17eb_948a_bef7724b5517["bailoutOffscreenComponent()"] cff6838d_8fc0_b94c_3dcd_2def67940837 -->|calls| 219a3239_d833_17eb_948a_bef7724b5517 style cff6838d_8fc0_b94c_3dcd_2def67940837 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberBeginWork.js lines 2752–2840
function updateSuspenseFallbackChildren(
current: Fiber,
workInProgress: Fiber,
primaryChildren: $FlowFixMe,
fallbackChildren: $FlowFixMe,
renderLanes: Lanes,
) {
const mode = workInProgress.mode;
const currentPrimaryChildFragment: Fiber = (current.child: any);
const currentFallbackChildFragment: Fiber | null =
currentPrimaryChildFragment.sibling;
const primaryChildProps: OffscreenProps = {
mode: 'hidden',
children: primaryChildren,
};
let primaryChildFragment;
if (
// In legacy mode, we commit the primary tree as if it successfully
// completed, even though it's in an inconsistent state.
!disableLegacyMode &&
(mode & ConcurrentMode) === NoMode &&
// Make sure we're on the second pass, i.e. the primary child fragment was
// already cloned. In legacy mode, the only case where this isn't true is
// when DevTools forces us to display a fallback; we skip the first render
// pass entirely and go straight to rendering the fallback. (In Concurrent
// Mode, SuspenseList can also trigger this scenario, but this is a legacy-
// only codepath.)
workInProgress.child !== currentPrimaryChildFragment
) {
const progressedPrimaryFragment: Fiber = (workInProgress.child: any);
primaryChildFragment = progressedPrimaryFragment;
primaryChildFragment.childLanes = NoLanes;
primaryChildFragment.pendingProps = primaryChildProps;
if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
// Reset the durations from the first pass so they aren't included in the
// final amounts. This seems counterintuitive, since we're intentionally
// not measuring part of the render phase, but this makes it match what we
// do in Concurrent Mode.
primaryChildFragment.actualDuration = -0;
primaryChildFragment.actualStartTime = -1.1;
primaryChildFragment.selfBaseDuration =
currentPrimaryChildFragment.selfBaseDuration;
primaryChildFragment.treeBaseDuration =
currentPrimaryChildFragment.treeBaseDuration;
}
// The fallback fiber was added as a deletion during the first pass.
// However, since we're going to remain on the fallback, we no longer want
// to delete it.
workInProgress.deletions = null;
} else {
primaryChildFragment = updateWorkInProgressOffscreenFiber(
currentPrimaryChildFragment,
primaryChildProps,
);
// Since we're reusing a current tree, we need to reuse the flags, too.
// (We don't do this in legacy mode, because in legacy mode we don't re-use
// the current tree; see previous branch.)
primaryChildFragment.subtreeFlags =
currentPrimaryChildFragment.subtreeFlags & StaticMask;
}
let fallbackChildFragment;
if (currentFallbackChildFragment !== null) {
fallbackChildFragment = createWorkInProgress(
currentFallbackChildFragment,
fallbackChildren,
);
} else {
fallbackChildFragment = createFiberFromFragment(
fallbackChildren,
mode,
renderLanes,
null,
);
// Needs a placement effect because the parent (the Suspense boundary) already
// mounted but this is a new fiber.
fallbackChildFragment.flags |= Placement;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does updateSuspenseFallbackChildren() do?
updateSuspenseFallbackChildren() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is updateSuspenseFallbackChildren() defined?
updateSuspenseFallbackChildren() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 2752.
What does updateSuspenseFallbackChildren() call?
updateSuspenseFallbackChildren() calls 2 function(s): bailoutOffscreenComponent, updateWorkInProgressOffscreenFiber.
What calls updateSuspenseFallbackChildren()?
updateSuspenseFallbackChildren() is called by 1 function(s): updateSuspenseComponent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free