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

Function resumeMountClassInstance

code/third-party/public/app.js:7791–7902  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

7789 }
7790
7791 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
7792 var ctor = workInProgress.type;
7793 var instance = workInProgress.stateNode;
7794 resetInputPointers(workInProgress, instance);
7795
7796 var oldProps = workInProgress.memoizedProps;
7797 var newProps = workInProgress.pendingProps;
7798 var oldContext = instance.context;
7799 var newUnmaskedContext = getUnmaskedContext(workInProgress);
7800 var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
7801
7802 // Note: During these life-cycles, instance.props/instance.state are what
7803 // ever the previously attempted to render - not the "current". However,
7804 // during componentDidUpdate we pass the "current" props.
7805
7806 // In order to support react-lifecycles-compat polyfilled components,
7807 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
7808 if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') {
7809 if (oldProps !== newProps || oldContext !== newContext) {
7810 callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
7811 }
7812 }
7813
7814 // Compute the next state using the memoized state and the update queue.
7815 var oldState = workInProgress.memoizedState;
7816 // TODO: Previous state can be null.
7817 var newState = void 0;
7818 var derivedStateFromCatch = void 0;
7819 if (workInProgress.updateQueue !== null) {
7820 newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime);
7821
7822 var updateQueue = workInProgress.updateQueue;
7823 if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') {
7824 var capturedValues = updateQueue.capturedValues;
7825 // Don't remove these from the update queue yet. We need them in
7826 // finishClassComponent. Do the reset there.
7827 // TODO: This is awkward. Refactor class components.
7828 // updateQueue.capturedValues = null;
7829 derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues);
7830 }
7831 } else {
7832 newState = oldState;
7833 }
7834
7835 var derivedStateFromProps = void 0;
7836 if (oldProps !== newProps) {
7837 // The prevState parameter should be the partially updated state.
7838 // Otherwise, spreading state in return values could override updates.
7839 derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState);
7840 }
7841
7842 if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) {
7843 // Render-phase updates (like this) should not be added to the update queue,
7844 // So that multiple render passes do not enqueue multiple updates.
7845 // Instead, just synchronously merge the returned state into the instance.
7846 newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps);
7847 }
7848 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