(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime)
| 9889 | } |
| 9890 | |
| 9891 | function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) { |
| 9892 | // Refs should update even if shouldComponentUpdate returns false |
| 9893 | markRef(current, workInProgress); |
| 9894 | |
| 9895 | if (!shouldUpdate && !didCaptureError) { |
| 9896 | // Context providers should defer to sCU for rendering |
| 9897 | if (hasContext) { |
| 9898 | invalidateContextProvider(workInProgress, false); |
| 9899 | } |
| 9900 | |
| 9901 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9902 | } |
| 9903 | |
| 9904 | var ctor = workInProgress.type; |
| 9905 | var instance = workInProgress.stateNode; |
| 9906 | |
| 9907 | // Rerender |
| 9908 | ReactCurrentOwner.current = workInProgress; |
| 9909 | var nextChildren = void 0; |
| 9910 | if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof ctor.getDerivedStateFromCatch !== 'function')) { |
| 9911 | // If we captured an error, but getDerivedStateFrom catch is not defined, |
| 9912 | // unmount all the children. componentDidCatch will schedule an update to |
| 9913 | // re-render a fallback. This is temporary until we migrate everyone to |
| 9914 | // the new API. |
| 9915 | // TODO: Warn in a future release. |
| 9916 | nextChildren = null; |
| 9917 | } else { |
| 9918 | { |
| 9919 | ReactDebugCurrentFiber.setCurrentPhase('render'); |
| 9920 | nextChildren = instance.render(); |
| 9921 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { |
| 9922 | instance.render(); |
| 9923 | } |
| 9924 | ReactDebugCurrentFiber.setCurrentPhase(null); |
| 9925 | } |
| 9926 | } |
| 9927 | |
| 9928 | // React DevTools reads this flag. |
| 9929 | workInProgress.effectTag |= PerformedWork; |
| 9930 | if (didCaptureError) { |
| 9931 | // If we're recovering from an error, reconcile twice: first to delete |
| 9932 | // all the existing children. |
| 9933 | reconcileChildrenAtExpirationTime(current, workInProgress, null, renderExpirationTime); |
| 9934 | workInProgress.child = null; |
| 9935 | // Now we can continue reconciling like normal. This has the effect of |
| 9936 | // remounting all children regardless of whether their their |
| 9937 | // identity matches. |
| 9938 | } |
| 9939 | reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime); |
| 9940 | // Memoize props and state using the values we just used to render. |
| 9941 | // TODO: Restructure so we never read values from the instance. |
| 9942 | memoizeState(workInProgress, instance.state); |
| 9943 | memoizeProps(workInProgress, instance.props); |
| 9944 | |
| 9945 | // The context might have changed so we need to recalculate it. |
| 9946 | if (hasContext) { |
| 9947 | invalidateContextProvider(workInProgress, true); |
| 9948 | } |
no test coverage detected