( current: null | Fiber, workInProgress: Fiber, renderLanes: Lanes, )
| 1796 | } |
| 1797 | |
| 1798 | function updateHostRoot( |
| 1799 | current: null | Fiber, |
| 1800 | workInProgress: Fiber, |
| 1801 | renderLanes: Lanes, |
| 1802 | ) { |
| 1803 | pushHostRootContext(workInProgress); |
| 1804 | |
| 1805 | if (current === null) { |
| 1806 | throw new Error('Should have a current fiber. This is a bug in React.'); |
| 1807 | } |
| 1808 | |
| 1809 | const nextProps = workInProgress.pendingProps; |
| 1810 | const prevState: RootState = workInProgress.memoizedState; |
| 1811 | const prevChildren = prevState.element; |
| 1812 | cloneUpdateQueue(current, workInProgress); |
| 1813 | processUpdateQueue(workInProgress, nextProps, null, renderLanes); |
| 1814 | |
| 1815 | const nextState: RootState = workInProgress.memoizedState; |
| 1816 | const root: FiberRoot = workInProgress.stateNode; |
| 1817 | pushRootTransition(workInProgress, root, renderLanes); |
| 1818 | |
| 1819 | if (enableTransitionTracing) { |
| 1820 | pushRootMarkerInstance(workInProgress); |
| 1821 | } |
| 1822 | |
| 1823 | const nextCache: Cache = nextState.cache; |
| 1824 | pushCacheProvider(workInProgress, nextCache); |
| 1825 | if (nextCache !== prevState.cache) { |
| 1826 | // The root cache refreshed. |
| 1827 | propagateContextChange(workInProgress, CacheContext, renderLanes); |
| 1828 | } |
| 1829 | |
| 1830 | // This would ideally go inside processUpdateQueue, but because it suspends, |
| 1831 | // it needs to happen after the `pushCacheProvider` call above to avoid a |
| 1832 | // context stack mismatch. A bit unfortunate. |
| 1833 | suspendIfUpdateReadFromEntangledAsyncAction(); |
| 1834 | |
| 1835 | // Caution: React DevTools currently depends on this property |
| 1836 | // being called "element". |
| 1837 | const nextChildren = nextState.element; |
| 1838 | if (supportsHydration && prevState.isDehydrated) { |
| 1839 | // This is a hydration root whose shell has not yet hydrated. We should |
| 1840 | // attempt to hydrate. |
| 1841 | |
| 1842 | // Flip isDehydrated to false to indicate that when this render |
| 1843 | // finishes, the root will no longer be dehydrated. |
| 1844 | const overrideState: RootState = { |
| 1845 | element: nextChildren, |
| 1846 | isDehydrated: false, |
| 1847 | cache: nextState.cache, |
| 1848 | }; |
| 1849 | const updateQueue: UpdateQueue<RootState> = |
| 1850 | (workInProgress.updateQueue: any); |
| 1851 | // `baseState` can always be the last state because the root doesn't |
| 1852 | // have reducer functions so it doesn't need rebasing. |
| 1853 | updateQueue.baseState = overrideState; |
| 1854 | workInProgress.memoizedState = overrideState; |
| 1855 |
no test coverage detected