MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / invalidateContextProvider

Function invalidateContextProvider

code/styling/public/app.js:12446–12468  ·  view source on GitHub ↗
(workInProgress, didChange)

Source from the content-addressed store, hash-verified

12444 }
12445
12446 function invalidateContextProvider(workInProgress, didChange) {
12447 var instance = workInProgress.stateNode;
12448 !instance ? invariant(false, 'Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12449
12450 if (didChange) {
12451 // Merge parent and own context.
12452 // Skip this if we're not updating due to sCU.
12453 // This avoids unnecessarily recomputing memoized values.
12454 var mergedContext = processChildContext(workInProgress, previousContext);
12455 instance.__reactInternalMemoizedMergedChildContext = mergedContext;
12456
12457 // Replace the old (or empty) context with the new one.
12458 // It is important to unwind the context in the reverse order.
12459 pop(didPerformWorkStackCursor, workInProgress);
12460 pop(contextStackCursor, workInProgress);
12461 // Now push the new context and mark that it has changed.
12462 push(contextStackCursor, mergedContext, workInProgress);
12463 push(didPerformWorkStackCursor, didChange, workInProgress);
12464 } else {
12465 pop(didPerformWorkStackCursor, workInProgress);
12466 push(didPerformWorkStackCursor, didChange, workInProgress);
12467 }
12468 }
12469
12470 function findCurrentUnmaskedContext(fiber) {
12471 // Currently this is only used with renderSubtreeIntoContainer; not sure if it

Callers 1

finishClassComponentFunction · 0.70

Calls 4

invariantFunction · 0.70
processChildContextFunction · 0.70
popFunction · 0.70
pushFunction · 0.70

Tested by

no test coverage detected