Virtual whiteboard for sketching hand-drawn like diagrams
fix: remove invisible elements safely (#7083)
David Luzar8b838049dfbf
diff --git a/src/actions/actionFinalize.tsx b/src/actions/actionFinalize.tsxindex c25e2ef4d0..4d422994c2 100644--- a/src/actions/actionFinalize.tsx+++ b/src/actions/actionFinalize.tsx@@ -90,7 +90,9 @@ export const actionFinalize = register({}}if (isInvisiblySmallElement(multiPointElement)) {- newElements = newElements.slice(0, -1);+ newElements = newElements.filter(+ (el) => el.id !== multiPointElement.id,+ );}// If the multi point line closes the loop,diff --git a/src/components/App.tsx b/src/components/App.tsxindex b91e0e4b57..2e7c468eb0 100644--- a/src/components/App.tsx+++ b/src/components/App.tsx@@ -6549,7 +6549,9 @@ class App extends React.Component<AppProps, AppState> {) {// remove invisible element which was added in onPointerDownthis.scene.replaceAllElements(- this.scene.getElementsIncludingDeleted().slice(0, -1),+ this.scene+ .getElementsIncludingDeleted()+ .filter((el) => el.id !== draggingElement.id),);this.setState({draggingElement: null,