MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / resumeMountClassInstance

Function resumeMountClassInstance

code/styling/public/app.js:8558–8669  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

8556 }
8557
8558 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
8559 var ctor = workInProgress.type;
8560 var instance = workInProgress.stateNode;
8561 resetInputPointers(workInProgress, instance);
8562
8563 var oldProps = workInProgress.memoizedProps;
8564 var newProps = workInProgress.pendingProps;
8565 var oldContext = instance.context;
8566 var newUnmaskedContext = getUnmaskedContext(workInProgress);
8567 var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
8568
8569 // Note: During these life-cycles, instance.props/instance.state are what
8570 // ever the previously attempted to render - not the "current". However,
8571 // during componentDidUpdate we pass the "current" props.
8572
8573 // In order to support react-lifecycles-compat polyfilled components,
8574 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
8575 if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') {
8576 if (oldProps !== newProps || oldContext !== newContext) {
8577 callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
8578 }
8579 }
8580
8581 // Compute the next state using the memoized state and the update queue.
8582 var oldState = workInProgress.memoizedState;
8583 // TODO: Previous state can be null.
8584 var newState = void 0;
8585 var derivedStateFromCatch = void 0;
8586 if (workInProgress.updateQueue !== null) {
8587 newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime);
8588
8589 var updateQueue = workInProgress.updateQueue;
8590 if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') {
8591 var capturedValues = updateQueue.capturedValues;
8592 // Don't remove these from the update queue yet. We need them in
8593 // finishClassComponent. Do the reset there.
8594 // TODO: This is awkward. Refactor class components.
8595 // updateQueue.capturedValues = null;
8596 derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues);
8597 }
8598 } else {
8599 newState = oldState;
8600 }
8601
8602 var derivedStateFromProps = void 0;
8603 if (oldProps !== newProps) {
8604 // The prevState parameter should be the partially updated state.
8605 // Otherwise, spreading state in return values could override updates.
8606 derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState);
8607 }
8608
8609 if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) {
8610 // Render-phase updates (like this) should not be added to the update queue,
8611 // So that multiple render passes do not enqueue multiple updates.
8612 // Instead, just synchronously merge the returned state into the instance.
8613 newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps);
8614 }
8615 if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) {

Callers 1

updateClassComponentFunction · 0.70

Calls 13

resetInputPointersFunction · 0.70
getUnmaskedContextFunction · 0.70
getMaskedContextFunction · 0.70
processUpdateQueueFunction · 0.70
hasContextChangedFunction · 0.70
startPhaseTimerFunction · 0.70
stopPhaseTimerFunction · 0.70
memoizePropsFunction · 0.70

Tested by

no test coverage detected