MCPcopy Create free account
hub / github.com/reactjs/react-rails / updateContextProvider

Function updateContextProvider

lib/assets/react-source/development/react.js:21917–21953  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

21915 }
21916
21917 function updateContextProvider(current, workInProgress, renderExpirationTime) {
21918 var providerType = workInProgress.type;
21919 var context = providerType._context;
21920 var newProps = workInProgress.pendingProps;
21921 var oldProps = workInProgress.memoizedProps;
21922 var newValue = newProps.value;
21923
21924 {
21925 var providerPropTypes = workInProgress.type.propTypes;
21926
21927 if (providerPropTypes) {
21928 checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
21929 }
21930 }
21931
21932 pushProvider(workInProgress, newValue);
21933
21934 if (oldProps !== null) {
21935 var oldValue = oldProps.value;
21936 var changedBits = calculateChangedBits(context, newValue, oldValue);
21937
21938 if (changedBits === 0) {
21939 // No change. Bailout early if children are the same.
21940 if (oldProps.children === newProps.children && !hasContextChanged()) {
21941 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
21942 }
21943 } else {
21944 // The context value changed. Search for matching consumers and schedule
21945 // them to update.
21946 propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
21947 }
21948 }
21949
21950 var newChildren = newProps.children;
21951 reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
21952 return workInProgress.child;
21953 }
21954
21955 var hasWarnedAboutUsingContextAsConsumer = false;
21956

Callers 1

beginWorkFunction · 0.85

Calls 7

pushProviderFunction · 0.85
calculateChangedBitsFunction · 0.85
hasContextChangedFunction · 0.85
propagateContextChangeFunction · 0.85
reconcileChildrenFunction · 0.85
checkPropTypesFunction · 0.70

Tested by

no test coverage detected