MCPcopy Index your code
hub / github.com/microsoft/SandDance / getMaskedContext

Function getMaskedContext

docs/external/js/react-dom.development.js:10838–10875  ·  view source on GitHub ↗
(workInProgress, unmaskedContext)

Source from the content-addressed store, hash-verified

10836 }
10837
10838 function getMaskedContext(workInProgress, unmaskedContext) {
10839 {
10840 var type = workInProgress.type;
10841 var contextTypes = type.contextTypes;
10842
10843 if (!contextTypes) {
10844 return emptyContextObject;
10845 } // Avoid recreating masked context unless unmasked context has changed.
10846 // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
10847 // This may trigger infinite loops if componentWillReceiveProps calls setState.
10848
10849
10850 var instance = workInProgress.stateNode;
10851
10852 if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
10853 return instance.__reactInternalMemoizedMaskedChildContext;
10854 }
10855
10856 var context = {};
10857
10858 for (var key in contextTypes) {
10859 context[key] = unmaskedContext[key];
10860 }
10861
10862 {
10863 var name = getComponentName(type) || 'Unknown';
10864 checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
10865 } // Cache unmasked context so we can avoid recreating masked context unless necessary.
10866 // Context is created before the class component is instantiated so check for instance.
10867
10868
10869 if (instance) {
10870 cacheContext(workInProgress, unmaskedContext, context);
10871 }
10872
10873 return context;
10874 }
10875 }
10876
10877 function hasContextChanged() {
10878 {

Callers 6

constructClassInstanceFunction · 0.85
mountClassInstanceFunction · 0.85
resumeMountClassInstanceFunction · 0.85
updateClassInstanceFunction · 0.85
updateFunctionComponentFunction · 0.85

Calls 2

cacheContextFunction · 0.85
getComponentNameFunction · 0.70

Tested by

no test coverage detected