MCPcopy Index your code
hub / github.com/react/react / shouldRemainOnFallback

Function shouldRemainOnFallback

packages/react-reconciler/src/ReactFiberBeginWork.js:2295–2322  ·  view source on GitHub ↗
(
  current: null | Fiber,
  workInProgress: Fiber,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

2293
2294// TODO: Probably should inline this back
2295function shouldRemainOnFallback(
2296 current: null | Fiber,
2297 workInProgress: Fiber,
2298 renderLanes: Lanes,
2299) {
2300 // If we're already showing a fallback, there are cases where we need to
2301 // remain on that fallback regardless of whether the content has resolved.
2302 // For example, SuspenseList coordinates when nested content appears.
2303 // TODO: For compatibility with offscreen prerendering, this should also check
2304 // whether the current fiber (if it exists) was visible in the previous tree.
2305 if (current !== null) {
2306 const suspenseState: SuspenseState = current.memoizedState;
2307 if (suspenseState === null) {
2308 // Currently showing content. Don't hide it, even if ForceSuspenseFallback
2309 // is true. More precise name might be "ForceRemainSuspenseFallback".
2310 // Note: This is a factoring smell. Can't remain on a fallback if there's
2311 // no fallback to remain on.
2312 return false;
2313 }
2314 }
2315
2316 // Not currently showing content. Consult the Suspense context.
2317 const suspenseContext: SuspenseContext = suspenseStackCursor.current;
2318 return hasSuspenseListContext(
2319 suspenseContext,
2320 (ForceSuspenseFallback: SuspenseContext),
2321 );
2322}
2323
2324function getRemainingWorkInPrimaryTree(
2325 current: Fiber | null,

Callers 1

updateSuspenseComponentFunction · 0.85

Calls 1

hasSuspenseListContextFunction · 0.90

Tested by

no test coverage detected