Skip to content

Commit 209f32b

Browse files
authored
Fix: center on node feature works with collapsible disabled (#457)
1 parent 664976e commit 209f32b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Node/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ export default class Node extends React.Component<NodeProps, NodeState> {
6666
this.commitTransform();
6767
}
6868

69-
shouldComponentUpdate(nextProps: NodeProps) {
70-
return this.shouldNodeTransform(this.props, nextProps);
69+
shouldComponentUpdate(nextProps: NodeProps, nextState: NodeState) {
70+
return this.shouldNodeTransform(this.props, nextProps, this.state, nextState);
7171
}
7272

73-
shouldNodeTransform = (ownProps: NodeProps, nextProps: NodeProps) =>
73+
shouldNodeTransform = (ownProps: NodeProps, nextProps: NodeProps, ownState: NodeState, nextState: NodeState) =>
7474
nextProps.subscriptions !== ownProps.subscriptions ||
7575
nextProps.position.x !== ownProps.position.x ||
7676
nextProps.position.y !== ownProps.position.y ||
77-
nextProps.orientation !== ownProps.orientation;
77+
nextProps.orientation !== ownProps.orientation ||
78+
nextState.wasClicked !== ownState.wasClicked;
7879

7980
setTransform(
8081
position: NodeProps['position'],

0 commit comments

Comments
 (0)