MCPcopy Create free account
hub / github.com/microsoft/SandDance / updateContextProvider

Function updateContextProvider

docs/external/js/react-dom.development.js:18357–18393  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

18355 }
18356
18357 function updateContextProvider(current, workInProgress, renderExpirationTime) {
18358 var providerType = workInProgress.type;
18359 var context = providerType._context;
18360 var newProps = workInProgress.pendingProps;
18361 var oldProps = workInProgress.memoizedProps;
18362 var newValue = newProps.value;
18363
18364 {
18365 var providerPropTypes = workInProgress.type.propTypes;
18366
18367 if (providerPropTypes) {
18368 checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
18369 }
18370 }
18371
18372 pushProvider(workInProgress, newValue);
18373
18374 if (oldProps !== null) {
18375 var oldValue = oldProps.value;
18376 var changedBits = calculateChangedBits(context, newValue, oldValue);
18377
18378 if (changedBits === 0) {
18379 // No change. Bailout early if children are the same.
18380 if (oldProps.children === newProps.children && !hasContextChanged()) {
18381 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
18382 }
18383 } else {
18384 // The context value changed. Search for matching consumers and schedule
18385 // them to update.
18386 propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
18387 }
18388 }
18389
18390 var newChildren = newProps.children;
18391 reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
18392 return workInProgress.child;
18393 }
18394
18395 var hasWarnedAboutUsingContextAsConsumer = false;
18396

Callers 1

beginWorkFunction · 0.85

Calls 6

pushProviderFunction · 0.85
calculateChangedBitsFunction · 0.85
hasContextChangedFunction · 0.85
propagateContextChangeFunction · 0.85
reconcileChildrenFunction · 0.85

Tested by

no test coverage detected