Skip to content

Commit 89e2354

Browse files
move the resetting of sCU to the overridden function
1 parent d5373a3 commit 89e2354

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

packages/enzyme/src/ShallowWrapper.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ class ShallowWrapper {
389389
originalShouldComponentUpdate = instance.shouldComponentUpdate;
390390
instance.shouldComponentUpdate = (...args) => {
391391
shouldRender = originalShouldComponentUpdate.apply(instance, args);
392+
instance.shouldComponentUpdate = originalShouldComponentUpdate;
392393
return shouldRender;
393394
};
394395
}
@@ -402,9 +403,6 @@ class ShallowWrapper {
402403
) {
403404
instance.componentDidUpdate(prevProps, prevState, prevContext);
404405
}
405-
if (originalShouldComponentUpdate) {
406-
instance.shouldComponentUpdate = originalShouldComponentUpdate;
407-
}
408406
this.update();
409407
});
410408
});

0 commit comments

Comments
 (0)