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

Function updateMemoComponent

docs/external/js/react-dom.development.js:16974–17051  ·  view source on GitHub ↗
(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime)

Source from the content-addressed store, hash-verified

16972 }
16973
16974 function updateMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
16975 if (current === null) {
16976 var type = Component.type;
16977
16978 if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
16979 Component.defaultProps === undefined) {
16980 var resolvedType = type;
16981
16982 {
16983 resolvedType = resolveFunctionForHotReloading(type);
16984 } // If this is a plain function component without default props,
16985 // and with only the default shallow comparison, we upgrade it
16986 // to a SimpleMemoComponent to allow fast path updates.
16987
16988
16989 workInProgress.tag = SimpleMemoComponent;
16990 workInProgress.type = resolvedType;
16991
16992 {
16993 validateFunctionComponentInDev(workInProgress, type);
16994 }
16995
16996 return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
16997 }
16998
16999 {
17000 var innerPropTypes = type.propTypes;
17001
17002 if (innerPropTypes) {
17003 // Inner memo component props aren't currently validated in createElement.
17004 // We could move it there, but we'd still need this for lazy code path.
17005 checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
17006 'prop', getComponentName(type), getCurrentFiberStackInDev);
17007 }
17008 }
17009
17010 var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
17011 child.ref = workInProgress.ref;
17012 child.return = workInProgress;
17013 workInProgress.child = child;
17014 return child;
17015 }
17016
17017 {
17018 var _type = Component.type;
17019 var _innerPropTypes = _type.propTypes;
17020
17021 if (_innerPropTypes) {
17022 // Inner memo component props aren't currently validated in createElement.
17023 // We could move it there, but we'd still need this for lazy code path.
17024 checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
17025 'prop', getComponentName(_type), getCurrentFiberStackInDev);
17026 }
17027 }
17028
17029 var currentChild = current.child; // This is always exactly one child
17030
17031 if (updateExpirationTime < renderExpirationTime) {

Callers 2

mountLazyComponentFunction · 0.85
beginWorkFunction · 0.85

Calls 9

createWorkInProgressFunction · 0.85
getComponentNameFunction · 0.70
compareFunction · 0.70

Tested by

no test coverage detected