ReactFiberSuspenseComponent.js — react Source File
Architecture documentation for ReactFiberSuspenseComponent.js, a javascript file in the react codebase. 8 imports, 11 dependents.
Entity Profile
Dependency Diagram
graph LR 24334744_4c44_225b_6923_5be11133f949["ReactFiberSuspenseComponent.js"] 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"] 24334744_4c44_225b_6923_5be11133f949 --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f a6668d1d_397d_7807_719d_fdecf552fa4a["ReactFiberConfig.js"] 24334744_4c44_225b_6923_5be11133f949 --> a6668d1d_397d_7807_719d_fdecf552fa4a 768f6d67_77c1_be19_5596_a943eab59e05["ReactFiberLane.js"] 24334744_4c44_225b_6923_5be11133f949 --> 768f6d67_77c1_be19_5596_a943eab59e05 bcb1d0d7_8aa0_fc08_efc9_136215e5b3a1["ReactFiberTreeContext.js"] 24334744_4c44_225b_6923_5be11133f949 --> bcb1d0d7_8aa0_fc08_efc9_136215e5b3a1 3c1744da_8f82_b464_9a56_73fd7302132b["ReactCapturedValue.js"] 24334744_4c44_225b_6923_5be11133f949 --> 3c1744da_8f82_b464_9a56_73fd7302132b d3557f30_4fca_e30a_91c5_c23d4b8dba99["ReactWorkTags.js"] 24334744_4c44_225b_6923_5be11133f949 --> d3557f30_4fca_e30a_91c5_c23d4b8dba99 6773f9a2_fdb7_4938_741f_4887273ad469["ReactFiberFlags.js"] 24334744_4c44_225b_6923_5be11133f949 --> 6773f9a2_fdb7_4938_741f_4887273ad469 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] 24334744_4c44_225b_6923_5be11133f949 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"] 0be70812_cc0c_b210_f84f_8e61dd5f831c --> 24334744_4c44_225b_6923_5be11133f949 e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"] e0fbfbd5_47b0_a489_0b36_bbfad9245544 --> 24334744_4c44_225b_6923_5be11133f949 6b05669d_2f09_63a5_e79f_0afc195f25a3["ReactFiberCompleteWork.js"] 6b05669d_2f09_63a5_e79f_0afc195f25a3 --> 24334744_4c44_225b_6923_5be11133f949 4bc7109f_638d_d9f7_bf47_6ec55b2fa128["ReactFiberHydrationContext.js"] 4bc7109f_638d_d9f7_bf47_6ec55b2fa128 --> 24334744_4c44_225b_6923_5be11133f949 79172409_a09a_afa9_9185_df1c9182af84["ReactFiberOffscreenComponent.js"] 79172409_a09a_afa9_9185_df1c9182af84 --> 24334744_4c44_225b_6923_5be11133f949 3ff8c5da_88d9_c61b_6bdc_da766a43fd30["ReactFiberReconciler.js"] 3ff8c5da_88d9_c61b_6bdc_da766a43fd30 --> 24334744_4c44_225b_6923_5be11133f949 style 24334744_4c44_225b_6923_5be11133f949 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 {Wakeable, SuspenseListTailMode} from 'shared/ReactTypes';
import type {Fiber} from './ReactInternalTypes';
import type {SuspenseInstance} from './ReactFiberConfig';
import type {Lane} from './ReactFiberLane';
import type {TreeContext} from './ReactFiberTreeContext';
import type {CapturedValue} from './ReactCapturedValue';
import {SuspenseComponent, SuspenseListComponent} from './ReactWorkTags';
import {NoFlags, DidCapture} from './ReactFiberFlags';
import {
isSuspenseInstancePending,
isSuspenseInstanceFallback,
} from './ReactFiberConfig';
// A null SuspenseState represents an unsuspended normal Suspense boundary.
// A non-null SuspenseState means that it is blocked for one reason or another.
// - A non-null dehydrated field means it's blocked pending hydration.
// - A non-null dehydrated field can use isSuspenseInstancePending or
// isSuspenseInstanceFallback to query the reason for being dehydrated.
// - A null dehydrated field means it's blocked by something suspending and
// we're currently showing a fallback instead.
export type SuspenseState = {
// If this boundary is still dehydrated, we store the SuspenseInstance
// here to indicate that it is dehydrated (flag) and for quick access
// to check things like isSuspenseInstancePending.
dehydrated: null | SuspenseInstance,
treeContext: null | TreeContext,
// Represents the lane we should attempt to hydrate a dehydrated boundary at.
// OffscreenLane is the default for dehydrated boundaries.
// NoLane is the default for normal boundaries, which turns into "normal" pri.
retryLane: Lane,
// Stashed Errors that happened while attempting to hydrate this boundary.
hydrationErrors: Array<CapturedValue<mixed>> | null,
};
export type SuspenseListRenderState = {
isBackwards: boolean,
// The currently rendering tail row.
rendering: null | Fiber,
// The absolute time when we started rendering the most recent tail row.
renderingStartTime: number,
// The last of the already rendered children.
last: null | Fiber,
// Remaining rows on the tail of the list.
tail: null | Fiber,
// Tail insertions setting.
tailMode: SuspenseListTailMode,
// Keep track of total number of forks during multiple passes
treeForkCount: number,
};
export type RetryQueue = Set<Wakeable>;
export function findFirstSuspended(row: Fiber): null | Fiber {
let node = row;
while (node !== null) {
if (node.tag === SuspenseComponent) {
const state: SuspenseState | null = node.memoizedState;
if (state !== null) {
const dehydrated: null | SuspenseInstance = state.dehydrated;
if (
dehydrated === null ||
isSuspenseInstancePending(dehydrated) ||
isSuspenseInstanceFallback(dehydrated)
) {
return node;
}
}
} else if (
node.tag === SuspenseListComponent &&
// Independent revealOrder can't be trusted because it doesn't
// keep track of whether it suspended or not.
node.memoizedProps.revealOrder !== 'independent'
) {
const didSuspend = (node.flags & DidCapture) !== NoFlags;
if (didSuspend) {
return node;
}
} else if (node.child !== null) {
node.child.return = node;
node = node.child;
continue;
}
if (node === row) {
return null;
}
while (node.sibling === null) {
if (node.return === null || node.return === row) {
return null;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
return null;
}
Domain
Dependencies
Imported By
- packages/react-reconciler/src/ReactFiberBeginWork.js
- packages/react-reconciler/src/ReactFiberCommitWork.js
- packages/react-reconciler/src/ReactFiberCompleteWork.js
- packages/react-reconciler/src/ReactFiberHydrationContext.js
- packages/react-reconciler/src/ReactFiberOffscreenComponent.js
- packages/react-reconciler/src/ReactFiberReconciler.js
- packages/react-reconciler/src/ReactFiberSuspenseContext.js
- packages/react-reconciler/src/ReactFiberThrow.js
- packages/react-reconciler/src/ReactFiberTreeReflection.js
- packages/react-reconciler/src/ReactFiberUnwindWork.js
- packages/react-reconciler/src/ReactFiberWorkLoop.js
Source
Frequently Asked Questions
What does ReactFiberSuspenseComponent.js do?
ReactFiberSuspenseComponent.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFiberSuspenseComponent.js depend on?
ReactFiberSuspenseComponent.js imports 8 module(s): ReactCapturedValue.js, ReactFiberConfig.js, ReactFiberFlags.js, ReactFiberLane.js, ReactFiberTreeContext.js, ReactInternalTypes.js, ReactTypes, ReactWorkTags.js.
What files import ReactFiberSuspenseComponent.js?
ReactFiberSuspenseComponent.js is imported by 11 file(s): ReactFiberBeginWork.js, ReactFiberCommitWork.js, ReactFiberCompleteWork.js, ReactFiberHydrationContext.js, ReactFiberOffscreenComponent.js, ReactFiberReconciler.js, ReactFiberSuspenseContext.js, ReactFiberThrow.js, and 3 more.
Where is ReactFiberSuspenseComponent.js in the architecture?
ReactFiberSuspenseComponent.js is located at packages/react-reconciler/src/ReactFiberSuspenseComponent.js (domain: BabelCompiler, 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