浏览代码

fix: syncing 1-point lines to remote clients (#5677)

David Luzar 2 年之前
父节点
当前提交
6c15d9948b
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/actions/actionDeleteSelected.tsx

+ 6 - 1
src/actions/actionDeleteSelected.tsx

@@ -78,7 +78,12 @@ export const actionDeleteSelected = register({
         // case: deleting last remaining point
         element.points.length < 2
       ) {
-        const nextElements = elements.filter((el) => el.id !== element.id);
+        const nextElements = elements.map((el) => {
+          if (el.id === element.id) {
+            return newElementWith(el, { isDeleted: true });
+          }
+          return el;
+        });
         const nextAppState = handleGroupEditingState(appState, nextElements);
 
         return {