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

Function updateContextProvider

dash/deps/react-dom@18.2.0.js:21121–21166  ·  view source on GitHub ↗
(current, workInProgress, renderLanes)

Source from the content-addressed store, hash-verified

21119 var hasWarnedAboutUsingNoValuePropOnContextProvider = false;
21120
21121 function updateContextProvider(current, workInProgress, renderLanes) {
21122 var providerType = workInProgress.type;
21123 var context = providerType._context;
21124 var newProps = workInProgress.pendingProps;
21125 var oldProps = workInProgress.memoizedProps;
21126 var newValue = newProps.value;
21127
21128 {
21129 if (!('value' in newProps)) {
21130 if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
21131 hasWarnedAboutUsingNoValuePropOnContextProvider = true;
21132
21133 error('The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?');
21134 }
21135 }
21136
21137 var providerPropTypes = workInProgress.type.propTypes;
21138
21139 if (providerPropTypes) {
21140 checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider');
21141 }
21142 }
21143
21144 pushProvider(workInProgress, context, newValue);
21145
21146 {
21147 if (oldProps !== null) {
21148 var oldValue = oldProps.value;
21149
21150 if (objectIs(oldValue, newValue)) {
21151 // No change. Bailout early if children are the same.
21152 if (oldProps.children === newProps.children && !hasContextChanged()) {
21153 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
21154 }
21155 } else {
21156 // The context value changed. Search for matching consumers and schedule
21157 // them to update.
21158 propagateContextChange(workInProgress, context, renderLanes);
21159 }
21160 }
21161 }
21162
21163 var newChildren = newProps.children;
21164 reconcileChildren(current, workInProgress, newChildren, renderLanes);
21165 return workInProgress.child;
21166 }
21167
21168 var hasWarnedAboutUsingContextAsConsumer = false;
21169

Callers 1

beginWorkFunction · 0.70

Calls 7

errorFunction · 0.70
checkPropTypesFunction · 0.70
pushProviderFunction · 0.70
hasContextChangedFunction · 0.70
propagateContextChangeFunction · 0.70
reconcileChildrenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…