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

Function invalidateContextProvider

code/event-handlers/public/app.js:11776–11798  ·  view source on GitHub ↗
(workInProgress, didChange)

Source from the content-addressed store, hash-verified

11774 }
11775
11776 function invalidateContextProvider(workInProgress, didChange) {
11777 var instance = workInProgress.stateNode;
11778 !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;
11779
11780 if (didChange) {
11781 // Merge parent and own context.
11782 // Skip this if we're not updating due to sCU.
11783 // This avoids unnecessarily recomputing memoized values.
11784 var mergedContext = processChildContext(workInProgress, previousContext);
11785 instance.__reactInternalMemoizedMergedChildContext = mergedContext;
11786
11787 // Replace the old (or empty) context with the new one.
11788 // It is important to unwind the context in the reverse order.
11789 pop(didPerformWorkStackCursor, workInProgress);
11790 pop(contextStackCursor, workInProgress);
11791 // Now push the new context and mark that it has changed.
11792 push(contextStackCursor, mergedContext, workInProgress);
11793 push(didPerformWorkStackCursor, didChange, workInProgress);
11794 } else {
11795 pop(didPerformWorkStackCursor, workInProgress);
11796 push(didPerformWorkStackCursor, didChange, workInProgress);
11797 }
11798 }
11799
11800 function findCurrentUnmaskedContext(fiber) {
11801 // 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