Skip to content

Commit 05bfaa2

Browse files
committed
Keep setting instance.props/state before unmounting
This reverts part of the previous commit. It broke a test that verifies we use current props in componentWillUnmount if the fiber unmounts due to an error.
1 parent e306c6b commit 05bfaa2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

packages/react-reconciler/src/ReactFiberCommitWork.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ export function logError(boundary: Fiber, errorInfo: CapturedValue<mixed>) {
143143

144144
const callComponentWillUnmountWithTimer = function(current, instance) {
145145
startPhaseTimer(current, 'componentWillUnmount');
146-
// We could update instance props and state here,
147-
// but instead we rely on them being set during last render.
148-
// TODO: revisit this when we implement resuming.
146+
instance.props = current.memoizedProps;
147+
instance.state = current.memoizedState;
149148
instance.componentWillUnmount();
150149
stopPhaseTimer();
151150
};

0 commit comments

Comments
 (0)