Skip to content

Commit

Permalink
replace set state with trigger update for multipoint lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-di committed Aug 23, 2024
1 parent e635f2e commit 165c8a9
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions packages/excalidraw/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5589,10 +5589,6 @@ class App extends React.Component<AppProps, AppState> {
},
false,
);
this.setState({
multiElement,
newElement: multiElement,
});
} else {
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
// in this branch, we're inside the commit zone, and no uncommitted
Expand All @@ -5616,10 +5612,6 @@ class App extends React.Component<AppProps, AppState> {
},
false,
);
this.setState({
multiElement,
newElement: multiElement,
});
} else {
const [gridX, gridY] = getGridPoint(
scenePointerX,
Expand Down Expand Up @@ -5684,10 +5676,11 @@ class App extends React.Component<AppProps, AppState> {
false,
);
}
this.setState({
multiElement,
newElement: multiElement,
});

// in this path, we're mutating multiElement to reflect
// how it will be after adding pointer position as the next point
// trigger update here so that new element canvas renders again to reflect this
this.scene.triggerUpdate(false);
}

return;
Expand Down

0 comments on commit 165c8a9

Please sign in to comment.