MCPcopy Create free account
hub / github.com/plotly/dash / updateMemoComponent

Function updateMemoComponent

dash/deps/react-dom@18.3.1.js:19291–19380  ·  view source on GitHub ↗
(current, workInProgress, Component, nextProps, renderLanes)

Source from the content-addressed store, hash-verified

19289 }
19290
19291 function updateMemoComponent(current, workInProgress, Component, nextProps, renderLanes) {
19292 if (current === null) {
19293 var type = Component.type;
19294
19295 if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
19296 Component.defaultProps === undefined) {
19297 var resolvedType = type;
19298
19299 {
19300 resolvedType = resolveFunctionForHotReloading(type);
19301 } // If this is a plain function component without default props,
19302 // and with only the default shallow comparison, we upgrade it
19303 // to a SimpleMemoComponent to allow fast path updates.
19304
19305
19306 workInProgress.tag = SimpleMemoComponent;
19307 workInProgress.type = resolvedType;
19308
19309 {
19310 validateFunctionComponentInDev(workInProgress, type);
19311 }
19312
19313 return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, renderLanes);
19314 }
19315
19316 {
19317 var innerPropTypes = type.propTypes;
19318
19319 if (innerPropTypes) {
19320 // Inner memo component props aren't currently validated in createElement.
19321 // We could move it there, but we'd still need this for lazy code path.
19322 checkPropTypes(innerPropTypes, nextProps, // Resolved props
19323 'prop', getComponentNameFromType(type));
19324 }
19325
19326 if ( Component.defaultProps !== undefined) {
19327 var componentName = getComponentNameFromType(type) || 'Unknown';
19328
19329 if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
19330 error('%s: Support for defaultProps will be removed from memo components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName);
19331
19332 didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
19333 }
19334 }
19335 }
19336
19337 var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes);
19338 child.ref = workInProgress.ref;
19339 child.return = workInProgress;
19340 workInProgress.child = child;
19341 return child;
19342 }
19343
19344 {
19345 var _type = Component.type;
19346 var _innerPropTypes = _type.propTypes;
19347
19348 if (_innerPropTypes) {

Callers 2

mountLazyComponentFunction · 0.70
beginWorkFunction · 0.70

Calls 12

checkPropTypesFunction · 0.70
getComponentNameFromTypeFunction · 0.70
errorFunction · 0.70
compareFunction · 0.70
createWorkInProgressFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…