Skip to content

Commit fc5af60

Browse files
committed
Avoid unnecessary state update when unselecting
1 parent 3babcb4 commit fc5af60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Graph.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,10 @@ class Graph extends React.Component {
557557
unSelectComponents() {
558558
this.selectRects.remove();
559559
this.selectRects = d3_select(null);
560-
this.selectedComponents = d3_selectAll(null);
561-
this.props.onSelect([]);
560+
if (this.selectedComponents.size() > 0) {
561+
this.selectedComponents = d3_selectAll(null);
562+
this.props.onSelect([]);
563+
}
562564
}
563565

564566
deleteSelectedComponents() {

0 commit comments

Comments
 (0)