MCPcopy
hub / github.com/plotly/dash / getMaskedContext

Function getMaskedContext

dash/deps/react-dom@18.2.0.js:11811–11848  ·  view source on GitHub ↗
(workInProgress, unmaskedContext)

Source from the content-addressed store, hash-verified

11809 }
11810
11811 function getMaskedContext(workInProgress, unmaskedContext) {
11812 {
11813 var type = workInProgress.type;
11814 var contextTypes = type.contextTypes;
11815
11816 if (!contextTypes) {
11817 return emptyContextObject;
11818 } // Avoid recreating masked context unless unmasked context has changed.
11819 // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
11820 // This may trigger infinite loops if componentWillReceiveProps calls setState.
11821
11822
11823 var instance = workInProgress.stateNode;
11824
11825 if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
11826 return instance.__reactInternalMemoizedMaskedChildContext;
11827 }
11828
11829 var context = {};
11830
11831 for (var key in contextTypes) {
11832 context[key] = unmaskedContext[key];
11833 }
11834
11835 {
11836 var name = getComponentNameFromFiber(workInProgress) || 'Unknown';
11837 checkPropTypes(contextTypes, context, 'context', name);
11838 } // Cache unmasked context so we can avoid recreating masked context unless necessary.
11839 // Context is created before the class component is instantiated so check for instance.
11840
11841
11842 if (instance) {
11843 cacheContext(workInProgress, unmaskedContext, context);
11844 }
11845
11846 return context;
11847 }
11848 }
11849
11850 function hasContextChanged() {
11851 {

Callers 6

constructClassInstanceFunction · 0.70
mountClassInstanceFunction · 0.70
resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70
updateFunctionComponentFunction · 0.70

Calls 3

checkPropTypesFunction · 0.70
cacheContextFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…