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

Function processChildContext

dash/deps/react-dom@18.2.0.js:11888–11923  ·  view source on GitHub ↗
(fiber, type, parentContext)

Source from the content-addressed store, hash-verified

11886 }
11887
11888 function processChildContext(fiber, type, parentContext) {
11889 {
11890 var instance = fiber.stateNode;
11891 var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future.
11892 // It has only been added in Fiber to match the (unintentional) behavior in Stack.
11893
11894 if (typeof instance.getChildContext !== 'function') {
11895 {
11896 var componentName = getComponentNameFromFiber(fiber) || 'Unknown';
11897
11898 if (!warnedAboutMissingGetChildContext[componentName]) {
11899 warnedAboutMissingGetChildContext[componentName] = true;
11900
11901 error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
11902 }
11903 }
11904
11905 return parentContext;
11906 }
11907
11908 var childContext = instance.getChildContext();
11909
11910 for (var contextKey in childContext) {
11911 if (!(contextKey in childContextTypes)) {
11912 throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
11913 }
11914 }
11915
11916 {
11917 var name = getComponentNameFromFiber(fiber) || 'Unknown';
11918 checkPropTypes(childContextTypes, childContext, 'child context', name);
11919 }
11920
11921 return assign({}, parentContext, childContext);
11922 }
11923 }
11924
11925 function pushContextProvider(workInProgress) {
11926 {

Callers 2

getContextForSubtreeFunction · 0.70

Calls 3

errorFunction · 0.70
checkPropTypesFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…