MCPcopy Index your code
hub / github.com/microsoft/SandDance / updateClassComponent

Function updateClassComponent

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

Source from the content-addressed store, hash-verified

17190 }
17191
17192 function updateClassComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
17193 {
17194 if (workInProgress.type !== workInProgress.elementType) {
17195 // Lazy component props can't be validated in createElement
17196 // because they're only guaranteed to be resolved here.
17197 var innerPropTypes = Component.propTypes;
17198
17199 if (innerPropTypes) {
17200 checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
17201 'prop', getComponentName(Component), getCurrentFiberStackInDev);
17202 }
17203 }
17204 } // Push context providers early to prevent context stack mismatches.
17205 // During mounting we don't know the child context yet as the instance doesn't exist.
17206 // We will invalidate the child context in finishClassComponent() right after rendering.
17207
17208
17209 var hasContext;
17210
17211 if (isContextProvider(Component)) {
17212 hasContext = true;
17213 pushContextProvider(workInProgress);
17214 } else {
17215 hasContext = false;
17216 }
17217
17218 prepareToReadContext(workInProgress, renderExpirationTime);
17219 var instance = workInProgress.stateNode;
17220 var shouldUpdate;
17221
17222 if (instance === null) {
17223 if (current !== null) {
17224 // A class component without an instance only mounts if it suspended
17225 // inside a non-concurrent tree, in an inconsistent state. We want to
17226 // treat it like a new mount, even though an empty version of it already
17227 // committed. Disconnect the alternate pointers.
17228 current.alternate = null;
17229 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
17230
17231 workInProgress.effectTag |= Placement;
17232 } // In the initial pass we might need to construct the instance.
17233
17234
17235 constructClassInstance(workInProgress, Component, nextProps);
17236 mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
17237 shouldUpdate = true;
17238 } else if (current === null) {
17239 // In a resume, we'll already have an instance we can reuse.
17240 shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
17241 } else {
17242 shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderExpirationTime);
17243 }
17244
17245 var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
17246
17247 {
17248 var inst = workInProgress.stateNode;
17249

Callers 2

mountLazyComponentFunction · 0.85
beginWorkFunction · 0.85

Calls 10

isContextProviderFunction · 0.85
pushContextProviderFunction · 0.85
prepareToReadContextFunction · 0.85
constructClassInstanceFunction · 0.85
mountClassInstanceFunction · 0.85
resumeMountClassInstanceFunction · 0.85
updateClassInstanceFunction · 0.85
finishClassComponentFunction · 0.85
getComponentNameFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected