(current, workInProgress, renderLanes)
| 19846 | } |
| 19847 | |
| 19848 | function updateHostRoot(current, workInProgress, renderLanes) { |
| 19849 | pushHostRootContext(workInProgress); |
| 19850 | |
| 19851 | if (current === null) { |
| 19852 | throw new Error('Should have a current fiber. This is a bug in React.'); |
| 19853 | } |
| 19854 | |
| 19855 | var nextProps = workInProgress.pendingProps; |
| 19856 | var prevState = workInProgress.memoizedState; |
| 19857 | var prevChildren = prevState.element; |
| 19858 | cloneUpdateQueue(current, workInProgress); |
| 19859 | processUpdateQueue(workInProgress, nextProps, null, renderLanes); |
| 19860 | var nextState = workInProgress.memoizedState; |
| 19861 | var root = workInProgress.stateNode; |
| 19862 | // being called "element". |
| 19863 | |
| 19864 | |
| 19865 | var nextChildren = nextState.element; |
| 19866 | |
| 19867 | if ( prevState.isDehydrated) { |
| 19868 | // This is a hydration root whose shell has not yet hydrated. We should |
| 19869 | // attempt to hydrate. |
| 19870 | // Flip isDehydrated to false to indicate that when this render |
| 19871 | // finishes, the root will no longer be dehydrated. |
| 19872 | var overrideState = { |
| 19873 | element: nextChildren, |
| 19874 | isDehydrated: false, |
| 19875 | cache: nextState.cache, |
| 19876 | pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries, |
| 19877 | transitions: nextState.transitions |
| 19878 | }; |
| 19879 | var updateQueue = workInProgress.updateQueue; // `baseState` can always be the last state because the root doesn't |
| 19880 | // have reducer functions so it doesn't need rebasing. |
| 19881 | |
| 19882 | updateQueue.baseState = overrideState; |
| 19883 | workInProgress.memoizedState = overrideState; |
| 19884 | |
| 19885 | if (workInProgress.flags & ForceClientRender) { |
| 19886 | // Something errored during a previous attempt to hydrate the shell, so we |
| 19887 | // forced a client render. |
| 19888 | var recoverableError = createCapturedValueAtFiber(new Error('There was an error while hydrating. Because the error happened outside ' + 'of a Suspense boundary, the entire root will switch to ' + 'client rendering.'), workInProgress); |
| 19889 | return mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, recoverableError); |
| 19890 | } else if (nextChildren !== prevChildren) { |
| 19891 | var _recoverableError = createCapturedValueAtFiber(new Error('This root received an early update, before anything was able ' + 'hydrate. Switched the entire root to client rendering.'), workInProgress); |
| 19892 | |
| 19893 | return mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, _recoverableError); |
| 19894 | } else { |
| 19895 | // The outermost shell has not hydrated yet. Start hydrating. |
| 19896 | enterHydrationState(workInProgress); |
| 19897 | |
| 19898 | var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); |
| 19899 | workInProgress.child = child; |
| 19900 | var node = child; |
| 19901 | |
| 19902 | while (node) { |
| 19903 | // Mark each child as hydrating. This is a fast path to know whether this |
| 19904 | // tree is part of a hydrating tree. This is used to determine if a child |
| 19905 | // node has fully mounted yet, and for scheduling event replaying. |
no test coverage detected
searching dependent graphs…