( current: Fiber | null, workInProgress: Fiber, renderLanes: Lanes, )
| 61 | } from './ReactFiberTracingMarkerComponent'; |
| 62 | |
| 63 | function unwindWork( |
| 64 | current: Fiber | null, |
| 65 | workInProgress: Fiber, |
| 66 | renderLanes: Lanes, |
| 67 | ): Fiber | null { |
| 68 | // Note: This intentionally doesn't check if we're hydrating because comparing |
| 69 | // to the current tree provider fiber is just as fast and less error-prone. |
| 70 | // Ideally we would have a special version of the work loop only |
| 71 | // for hydration. |
| 72 | popTreeContext(workInProgress); |
| 73 | switch (workInProgress.tag) { |
| 74 | case ClassComponent: { |
| 75 | const Component = workInProgress.type; |
| 76 | if (isLegacyContextProvider(Component)) { |
| 77 | popLegacyContext(workInProgress); |
| 78 | } |
| 79 | const flags = workInProgress.flags; |
| 80 | if (flags & ShouldCapture) { |
| 81 | workInProgress.flags = (flags & ~ShouldCapture) | DidCapture; |
| 82 | if ( |
| 83 | enableProfilerTimer && |
| 84 | (workInProgress.mode & ProfileMode) !== NoMode |
| 85 | ) { |
| 86 | transferActualDuration(workInProgress); |
| 87 | } |
| 88 | return workInProgress; |
| 89 | } |
| 90 | return null; |
| 91 | } |
| 92 | case HostRoot: { |
| 93 | const root: FiberRoot = workInProgress.stateNode; |
| 94 | const cache: Cache = workInProgress.memoizedState.cache; |
| 95 | popCacheProvider(workInProgress, cache); |
| 96 | |
| 97 | if (enableTransitionTracing) { |
| 98 | popRootMarkerInstance(workInProgress); |
| 99 | } |
| 100 | |
| 101 | popRootTransition(workInProgress, root, renderLanes); |
| 102 | popHostContainer(workInProgress); |
| 103 | popTopLevelLegacyContextObject(workInProgress); |
| 104 | const flags = workInProgress.flags; |
| 105 | if ( |
| 106 | (flags & ShouldCapture) !== NoFlags && |
| 107 | (flags & DidCapture) === NoFlags |
| 108 | ) { |
| 109 | // There was an error during render that wasn't captured by a suspense |
| 110 | // boundary. Do a second pass on the root to unmount the children. |
| 111 | workInProgress.flags = (flags & ~ShouldCapture) | DidCapture; |
| 112 | return workInProgress; |
| 113 | } |
| 114 | // We unwound to the root without completing it. Exit. |
| 115 | return null; |
| 116 | } |
| 117 | case HostHoistable: |
| 118 | case HostSingleton: |
| 119 | case HostComponent: { |
| 120 | // TODO: popHydrationState |
no test coverage detected