Skip to content

Commit

Permalink
move the resetting of sCU to the overridden function
Browse files Browse the repository at this point in the history
  • Loading branch information
lelandrichardson committed Sep 26, 2017
1 parent d5373a3 commit 89e2354
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/enzyme/src/ShallowWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ class ShallowWrapper {
originalShouldComponentUpdate = instance.shouldComponentUpdate;
instance.shouldComponentUpdate = (...args) => {
shouldRender = originalShouldComponentUpdate.apply(instance, args);
instance.shouldComponentUpdate = originalShouldComponentUpdate;
return shouldRender;
};
}
Expand All @@ -402,9 +403,6 @@ class ShallowWrapper {
) {
instance.componentDidUpdate(prevProps, prevState, prevContext);
}
if (originalShouldComponentUpdate) {
instance.shouldComponentUpdate = originalShouldComponentUpdate;
}
this.update();
});
});
Expand Down

0 comments on commit 89e2354

Please sign in to comment.