Skip to content

Commit 3d0cfef

Browse files
committed
Transfer mounted effects on suspend in legacy mode
In legacy mode, a component that suspends bails out and commit in its previous state. If the component previously had mounted effects, we must transfer those to the work-in-progress so they don't get dropped.
1 parent 855aab3 commit 3d0cfef

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/react-reconciler/src/ReactFiberThrow.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ function throwException(
199199
// to render it.
200200
let currentSource = sourceFiber.alternate;
201201
if (currentSource) {
202+
sourceFiber.updateQueue = currentSource.updateQueue;
202203
sourceFiber.memoizedState = currentSource.memoizedState;
203204
sourceFiber.expirationTime = currentSource.expirationTime;
204205
} else {
206+
sourceFiber.updateQueue = null;
205207
sourceFiber.memoizedState = null;
206208
}
207209
}

0 commit comments

Comments
 (0)