(current, workInProgress, renderExpirationTime)
| 20900 | } |
| 20901 | |
| 20902 | function updateHostRoot(current, workInProgress, renderExpirationTime) { |
| 20903 | pushHostRootContext(workInProgress); |
| 20904 | var updateQueue = workInProgress.updateQueue; |
| 20905 | |
| 20906 | if (!(current !== null && updateQueue !== null)) { |
| 20907 | { |
| 20908 | throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." ); |
| 20909 | } |
| 20910 | } |
| 20911 | |
| 20912 | var nextProps = workInProgress.pendingProps; |
| 20913 | var prevState = workInProgress.memoizedState; |
| 20914 | var prevChildren = prevState !== null ? prevState.element : null; |
| 20915 | cloneUpdateQueue(current, workInProgress); |
| 20916 | processUpdateQueue(workInProgress, nextProps, null, renderExpirationTime); |
| 20917 | var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property |
| 20918 | // being called "element". |
| 20919 | |
| 20920 | var nextChildren = nextState.element; |
| 20921 | |
| 20922 | if (nextChildren === prevChildren) { |
| 20923 | // If the state is the same as before, that's a bailout because we had |
| 20924 | // no work that expires at this time. |
| 20925 | resetHydrationState(); |
| 20926 | return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); |
| 20927 | } |
| 20928 | |
| 20929 | var root = workInProgress.stateNode; |
| 20930 | |
| 20931 | if (root.hydrate && enterHydrationState(workInProgress)) { |
| 20932 | // If we don't have any current children this might be the first pass. |
| 20933 | // We always try to hydrate. If this isn't a hydration pass there won't |
| 20934 | // be any children to hydrate which is effectively the same thing as |
| 20935 | // not hydrating. |
| 20936 | var child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime); |
| 20937 | workInProgress.child = child; |
| 20938 | var node = child; |
| 20939 | |
| 20940 | while (node) { |
| 20941 | // Mark each child as hydrating. This is a fast path to know whether this |
| 20942 | // tree is part of a hydrating tree. This is used to determine if a child |
| 20943 | // node has fully mounted yet, and for scheduling event replaying. |
| 20944 | // Conceptually this is similar to Placement in that a new subtree is |
| 20945 | // inserted into the React tree here. It just happens to not need DOM |
| 20946 | // mutations because it already exists. |
| 20947 | node.effectTag = node.effectTag & ~Placement | Hydrating; |
| 20948 | node = node.sibling; |
| 20949 | } |
| 20950 | } else { |
| 20951 | // Otherwise reset hydration state in case we aborted and resumed another |
| 20952 | // root. |
| 20953 | reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); |
| 20954 | resetHydrationState(); |
| 20955 | } |
| 20956 | |
| 20957 | return workInProgress.child; |
| 20958 | } |
| 20959 |
no test coverage detected