ReactFiberSuspenseContext.js — react Source File
Architecture documentation for ReactFiberSuspenseContext.js, a javascript file in the react codebase. 8 imports, 5 dependents.
Entity Profile
Dependency Diagram
graph LR be9c7dd4_0030_1768_3ad3_f5acdbd08eef["ReactFiberSuspenseContext.js"] 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4["ReactFiberStack.js"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4 24334744_4c44_225b_6923_5be11133f949["ReactFiberSuspenseComponent.js"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> 24334744_4c44_225b_6923_5be11133f949 a53113f8_99e9_4566_6c5f_d1534c5c4ca8["ReactFiberHiddenContext.js"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> a53113f8_99e9_4566_6c5f_d1534c5c4ca8 912a4546_c9a8_68b1_2d25_c20e5ab573cb["isCurrentTreeHidden"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> 912a4546_c9a8_68b1_2d25_c20e5ab573cb d3557f30_4fca_e30a_91c5_c23d4b8dba99["ReactWorkTags.js"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> d3557f30_4fca_e30a_91c5_c23d4b8dba99 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"] be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> 8344de1b_978c_be0f_eebd_38ccc4962a93 0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"] 0be70812_cc0c_b210_f84f_8e61dd5f831c --> be9c7dd4_0030_1768_3ad3_f5acdbd08eef 6b05669d_2f09_63a5_e79f_0afc195f25a3["ReactFiberCompleteWork.js"] 6b05669d_2f09_63a5_e79f_0afc195f25a3 --> be9c7dd4_0030_1768_3ad3_f5acdbd08eef 2945bdb1_d075_d792_a028_13eee518c9d4["ReactFiberThrow.js"] 2945bdb1_d075_d792_a028_13eee518c9d4 --> be9c7dd4_0030_1768_3ad3_f5acdbd08eef 53e7e9e3_9e8c_648e_1f4e_0fdfa5c5cb8f["ReactFiberUnwindWork.js"] 53e7e9e3_9e8c_648e_1f4e_0fdfa5c5cb8f --> be9c7dd4_0030_1768_3ad3_f5acdbd08eef d73e9290_2d2e_5d3f_97dd_84929f205c77["ReactFiberWorkLoop.js"] d73e9290_2d2e_5d3f_97dd_84929f205c77 --> be9c7dd4_0030_1768_3ad3_f5acdbd08eef style be9c7dd4_0030_1768_3ad3_f5acdbd08eef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {SuspenseProps} from 'shared/ReactTypes';
import type {Fiber} from './ReactInternalTypes';
import type {StackCursor} from './ReactFiberStack';
import type {SuspenseState} from './ReactFiberSuspenseComponent';
import {enableSuspenseAvoidThisFallback} from 'shared/ReactFeatureFlags';
import {createCursor, push, pop} from './ReactFiberStack';
import {isCurrentTreeHidden} from './ReactFiberHiddenContext';
import {OffscreenComponent} from './ReactWorkTags';
// The Suspense handler is the boundary that should capture if something
// suspends, i.e. it's the nearest `catch` block on the stack.
const suspenseHandlerStackCursor: StackCursor<Fiber | null> =
createCursor(null);
// Represents the outermost boundary that is not visible in the current tree.
// Everything above this is the "shell". When this is null, it means we're
// rendering in the shell of the app. If it's non-null, it means we're rendering
// deeper than the shell, inside a new tree that wasn't already visible.
//
// The main way we use this concept is to determine whether showing a fallback
// would result in a desirable or undesirable loading state. Activing a fallback
// in the shell is considered an undersirable loading state, because it would
// mean hiding visible (albeit stale) content in the current tree — we prefer to
// show the stale content, rather than switch to a fallback. But showing a
// fallback in a new tree is fine, because there's no stale content to
// prefer instead.
let shellBoundary: Fiber | null = null;
export function getShellBoundary(): Fiber | null {
return shellBoundary;
}
export function pushPrimaryTreeSuspenseHandler(handler: Fiber): void {
// TODO: Pass as argument
const current = handler.alternate;
const props: SuspenseProps = handler.pendingProps;
// Shallow Suspense context fields, like ForceSuspenseFallback, should only be
// propagated a single level. For example, when ForceSuspenseFallback is set,
// it should only force the nearest Suspense boundary into fallback mode.
push(
suspenseStackCursor,
setDefaultShallowSuspenseListContext(suspenseStackCursor.current),
handler,
);
// Experimental feature: Some Suspense boundaries are marked as having an
// undesirable fallback state. These have special behavior where we only
// activate the fallback if there's no other boundary on the stack that we can
// use instead.
// ... (174 more lines)
Domain
Subdomains
Functions
- hasSuspenseListContext()
- popSuspenseHandler()
- popSuspenseListContext()
- pushDehydratedActivitySuspenseHandler()
- pushFallbackTreeSuspenseHandler()
- pushOffscreenSuspenseHandler()
- pushPrimaryTreeSuspenseHandler()
- pushSuspenseListCatch()
- pushSuspenseListContext()
- reuseSuspenseHandlerOnStack()
- setDefaultShallowSuspenseListContext()
- setShallowSuspenseListContext()
Dependencies
Imported By
Source
Frequently Asked Questions
What does ReactFiberSuspenseContext.js do?
ReactFiberSuspenseContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactFiberSuspenseContext.js?
ReactFiberSuspenseContext.js defines 12 function(s): hasSuspenseListContext, popSuspenseHandler, popSuspenseListContext, pushDehydratedActivitySuspenseHandler, pushFallbackTreeSuspenseHandler, pushOffscreenSuspenseHandler, pushPrimaryTreeSuspenseHandler, pushSuspenseListCatch, pushSuspenseListContext, reuseSuspenseHandlerOnStack, and 2 more.
What does ReactFiberSuspenseContext.js depend on?
ReactFiberSuspenseContext.js imports 8 module(s): ReactFeatureFlags, ReactFiberHiddenContext.js, ReactFiberStack.js, ReactFiberSuspenseComponent.js, ReactInternalTypes.js, ReactTypes, ReactWorkTags.js, isCurrentTreeHidden.
What files import ReactFiberSuspenseContext.js?
ReactFiberSuspenseContext.js is imported by 5 file(s): ReactFiberBeginWork.js, ReactFiberCompleteWork.js, ReactFiberThrow.js, ReactFiberUnwindWork.js, ReactFiberWorkLoop.js.
Where is ReactFiberSuspenseContext.js in the architecture?
ReactFiberSuspenseContext.js is located at packages/react-reconciler/src/ReactFiberSuspenseContext.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-reconciler/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free