Skip to content

Commit

Permalink
Add condition whether enabling lifecycle.componentDidUpdate or not
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Jul 4, 2018
1 parent b508490 commit 899f222
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/enzyme/src/ShallowWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@ class ShallowWrapper {
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
snapshot = instance.getSnapshotBeforeUpdate(prevProps, state);
}
if (typeof instance.componentDidUpdate === 'function') {
if (
lifecycles.componentDidUpdate &&
typeof instance.componentDidUpdate === 'function'
) {
instance.componentDidUpdate(prevProps, state, snapshot);
}
} else if (
Expand Down

0 comments on commit 899f222

Please sign in to comment.