Skip to content

Commit

Permalink
Keep setting instance.props/state before unmounting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gaearon committed Nov 6, 2018
1 parent e306c6b commit 05bfaa2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ export function logError(boundary: Fiber, errorInfo: CapturedValue<mixed>) {

const callComponentWillUnmountWithTimer = function(current, instance) {
startPhaseTimer(current, 'componentWillUnmount');
// We could update instance props and state here,
// but instead we rely on them being set during last render.
// TODO: revisit this when we implement resuming.
instance.props = current.memoizedProps;
instance.state = current.memoizedState;
instance.componentWillUnmount();
stopPhaseTimer();
};
Expand Down

0 comments on commit 05bfaa2

Please sign in to comment.