MCPcopy
hub / github.com/react/react / pushContextProvider

Function pushContextProvider

packages/react-reconciler/src/ReactFiberLegacyContext.js:213–237  ·  view source on GitHub ↗
(workInProgress: Fiber)

Source from the content-addressed store, hash-verified

211}
212
213function pushContextProvider(workInProgress: Fiber): boolean {
214 if (disableLegacyContext) {
215 return false;
216 } else {
217 const instance = workInProgress.stateNode;
218 // We push the context as early as possible to ensure stack integrity.
219 // If the instance does not exist yet, we will push null at first,
220 // and replace it on the stack later when invalidating the context.
221 const memoizedMergedChildContext =
222 (instance && instance.__reactInternalMemoizedMergedChildContext) ||
223 emptyContextObject;
224
225 // Remember the parent context so we can merge with it later.
226 // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
227 previousContext = contextStackCursor.current;
228 push(contextStackCursor, memoizedMergedChildContext, workInProgress);
229 push(
230 didPerformWorkStackCursor,
231 didPerformWorkStackCursor.current,
232 workInProgress,
233 );
234
235 return true;
236 }
237}
238
239function invalidateContextProvider(
240 workInProgress: Fiber,

Callers

nothing calls this directly

Calls 1

pushFunction · 0.90

Tested by

no test coverage detected