added shallow equal
This commit is contained in:
parent
a1dcb98e44
commit
e6b85465a6
|
|
@ -67,6 +67,7 @@
|
||||||
"redux-form": "^8.2.6",
|
"redux-form": "^8.2.6",
|
||||||
"redux-saga": "^1.0.0",
|
"redux-saga": "^1.0.0",
|
||||||
"reselect": "^4.0.0",
|
"reselect": "^4.0.0",
|
||||||
|
"shallowequal": "^1.1.0",
|
||||||
"styled-components": "^4.1.3",
|
"styled-components": "^4.1.3",
|
||||||
"ts-loader": "^6.0.4",
|
"ts-loader": "^6.0.4",
|
||||||
"typescript": "^3.6.3"
|
"typescript": "^3.6.3"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import DraggableComponent from "../components/editorComponents/DraggableComponen
|
||||||
import ResizableComponent from "../components/editorComponents/ResizableComponent";
|
import ResizableComponent from "../components/editorComponents/ResizableComponent";
|
||||||
import { ActionPayload } from "../constants/ActionConstants";
|
import { ActionPayload } from "../constants/ActionConstants";
|
||||||
import { WidgetFunctionsContext } from "../pages/Editor/WidgetsEditor";
|
import { WidgetFunctionsContext } from "../pages/Editor/WidgetsEditor";
|
||||||
|
import shallowequal from "shallowequal";
|
||||||
|
|
||||||
abstract class BaseWidget<
|
abstract class BaseWidget<
|
||||||
T extends WidgetProps,
|
T extends WidgetProps,
|
||||||
|
|
@ -120,7 +121,8 @@ abstract class BaseWidget<
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: WidgetProps, nextState: WidgetState) {
|
shouldComponentUpdate(nextProps: WidgetProps, nextState: WidgetState) {
|
||||||
const isNotEqual =
|
const isNotEqual =
|
||||||
!_.isEqual(this.props, nextProps) || !_.isEqual(this.state, nextState);
|
!shallowequal(nextProps, this.props) ||
|
||||||
|
!shallowequal(nextState, this.state);
|
||||||
return isNotEqual;
|
return isNotEqual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user