Skip to content

Commit

Permalink
Use memoizedState in componentDidUpdate
Browse files Browse the repository at this point in the history
We forgot to clone this value so it didn't work before.
This is covered by existing tests in ReactDOMProduction.
  • Loading branch information
sebmarkbage committed Oct 11, 2016
1 parent ed448c9 commit d2fe722
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/renderers/shared/fiber/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ exports.cloneFiber = function(fiber : Fiber, priorityLevel : PriorityLevel) : Fi
alt.pendingWorkPriority = priorityLevel;

alt.memoizedProps = fiber.memoizedProps;
alt.memoizedState = fiber.memoizedState;
alt.output = fiber.output;

return alt;
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shared/fiber/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
const prevProps = current.memoizedProps;
// TODO: This is the new state. We don't currently have the previous
// state anymore.
const prevState = instance.state || null;
const prevState = current.memoizedState;
instance.componentDidUpdate(prevProps, prevState);
}
}
Expand Down

0 comments on commit d2fe722

Please sign in to comment.