Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit f002ef2

Browse files
committed
Added back shouldComponentUpdate in DefaultConnectedControl
1 parent e116397 commit f002ef2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/components/control-component.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,13 @@ function createControlClass(s = defaultStrategy) {
668668
/* eslint-disable react/prop-types */
669669
/* eslint-disable react/no-multi-comp */
670670
class DefaultConnectedControl extends React.Component {
671+
shouldComponentUpdate(nextProps, nextState, nextContext) {
672+
return !shallowEqual(this.context, nextContext) || !shallowEqual(this.props, nextProps, {
673+
deepKeys: ['controlProps'],
674+
omitKeys: ['mapProps'],
675+
});
676+
}
677+
671678
render() {
672679
return (
673680
<ConnectedControl
@@ -681,6 +688,9 @@ function createControlClass(s = defaultStrategy) {
681688
}
682689
}
683690

691+
// Copy the context types so that we can properly implement shouldComponentUpdate
692+
DefaultConnectedControl.contextTypes = ConnectedControl.contextTypes;
693+
684694
DefaultConnectedControl.custom = ConnectedControl;
685695

686696
class DefaultConnectedControlInput extends DefaultConnectedControl {

0 commit comments

Comments
 (0)