ReactFiberLegacyContext.js — react Source File
Architecture documentation for ReactFiberLegacyContext.js, a javascript file in the react codebase. 5 imports, 7 dependents.
Entity Profile
Dependency Diagram
graph LR 62553dd6_34d9_8b09_7c89_927d1610c445["ReactFiberLegacyContext.js"] 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"] 62553dd6_34d9_8b09_7c89_927d1610c445 --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4["ReactFiberStack.js"] 62553dd6_34d9_8b09_7c89_927d1610c445 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4 d3557f30_4fca_e30a_91c5_c23d4b8dba99["ReactWorkTags.js"] 62553dd6_34d9_8b09_7c89_927d1610c445 --> d3557f30_4fca_e30a_91c5_c23d4b8dba99 8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"] 62553dd6_34d9_8b09_7c89_927d1610c445 --> 8344de1b_978c_be0f_eebd_38ccc4962a93 6f207e69_195c_8592_d157_684fe7967d1f["getComponentNameFromFiber"] 62553dd6_34d9_8b09_7c89_927d1610c445 --> 6f207e69_195c_8592_d157_684fe7967d1f 0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"] 0be70812_cc0c_b210_f84f_8e61dd5f831c --> 62553dd6_34d9_8b09_7c89_927d1610c445 3805476a_1924_0e35_fff7_6afad197a523["ReactFiberClassComponent.js"] 3805476a_1924_0e35_fff7_6afad197a523 --> 62553dd6_34d9_8b09_7c89_927d1610c445 6b05669d_2f09_63a5_e79f_0afc195f25a3["ReactFiberCompleteWork.js"] 6b05669d_2f09_63a5_e79f_0afc195f25a3 --> 62553dd6_34d9_8b09_7c89_927d1610c445 da68ece0_17b1_3c98_d393_5c830eacd9b2["ReactFiberHotReloading.js"] da68ece0_17b1_3c98_d393_5c830eacd9b2 --> 62553dd6_34d9_8b09_7c89_927d1610c445 3ff8c5da_88d9_c61b_6bdc_da766a43fd30["ReactFiberReconciler.js"] 3ff8c5da_88d9_c61b_6bdc_da766a43fd30 --> 62553dd6_34d9_8b09_7c89_927d1610c445 53e7e9e3_9e8c_648e_1f4e_0fdfa5c5cb8f["ReactFiberUnwindWork.js"] 53e7e9e3_9e8c_648e_1f4e_0fdfa5c5cb8f --> 62553dd6_34d9_8b09_7c89_927d1610c445 d73e9290_2d2e_5d3f_97dd_84929f205c77["ReactFiberWorkLoop.js"] d73e9290_2d2e_5d3f_97dd_84929f205c77 --> 62553dd6_34d9_8b09_7c89_927d1610c445 style 62553dd6_34d9_8b09_7c89_927d1610c445 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 {Fiber} from './ReactInternalTypes';
import type {StackCursor} from './ReactFiberStack';
import {disableLegacyContext} from 'shared/ReactFeatureFlags';
import {ClassComponent, HostRoot} from './ReactWorkTags';
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
import {createCursor, push, pop} from './ReactFiberStack';
let warnedAboutMissingGetChildContext;
if (__DEV__) {
warnedAboutMissingGetChildContext = ({}: {[string]: boolean});
}
export const emptyContextObject: {} = {};
if (__DEV__) {
Object.freeze(emptyContextObject);
}
// A cursor to the current merged context object on the stack.
const contextStackCursor: StackCursor<Object> =
createCursor(emptyContextObject);
// A cursor to a boolean indicating whether the context has changed.
const didPerformWorkStackCursor: StackCursor<boolean> = createCursor(false);
// Keep track of the previous context object that was on the stack.
// We use this to get access to the parent context after we have already
// pushed the next context provider, and now need to merge their contexts.
let previousContext: Object = emptyContextObject;
function getUnmaskedContext(
workInProgress: Fiber,
Component: Function,
didPushOwnContextIfProvider: boolean,
): Object {
if (disableLegacyContext) {
return emptyContextObject;
} else {
if (didPushOwnContextIfProvider && isContextProvider(Component)) {
// If the fiber is a context provider itself, when we read its context
// we may have already pushed its own child context on the stack. A context
// provider should not "see" its own child context. Therefore we read the
// previous (parent) context instead for a context provider.
return previousContext;
}
return contextStackCursor.current;
}
}
function cacheContext(
workInProgress: Fiber,
// ... (265 more lines)
Domain
Dependencies
- ReactFeatureFlags
- ReactFiberStack.js
- ReactInternalTypes.js
- ReactWorkTags.js
- getComponentNameFromFiber
Imported By
- packages/react-reconciler/src/ReactFiberBeginWork.js
- packages/react-reconciler/src/ReactFiberClassComponent.js
- packages/react-reconciler/src/ReactFiberCompleteWork.js
- packages/react-reconciler/src/ReactFiberHotReloading.js
- packages/react-reconciler/src/ReactFiberReconciler.js
- packages/react-reconciler/src/ReactFiberUnwindWork.js
- packages/react-reconciler/src/ReactFiberWorkLoop.js
Source
Frequently Asked Questions
What does ReactFiberLegacyContext.js do?
ReactFiberLegacyContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFiberLegacyContext.js depend on?
ReactFiberLegacyContext.js imports 5 module(s): ReactFeatureFlags, ReactFiberStack.js, ReactInternalTypes.js, ReactWorkTags.js, getComponentNameFromFiber.
What files import ReactFiberLegacyContext.js?
ReactFiberLegacyContext.js is imported by 7 file(s): ReactFiberBeginWork.js, ReactFiberClassComponent.js, ReactFiberCompleteWork.js, ReactFiberHotReloading.js, ReactFiberReconciler.js, ReactFiberUnwindWork.js, ReactFiberWorkLoop.js.
Where is ReactFiberLegacyContext.js in the architecture?
ReactFiberLegacyContext.js is located at packages/react-reconciler/src/ReactFiberLegacyContext.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