Browse Source

filter out selection elements on restore (#901)

* filter out selection elements on restore

* add comment
David Luzar 5 năm trước cách đây
mục cha
commit
13b838117c
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/data/restore.ts

+ 5 - 1
src/data/restore.ts

@@ -13,7 +13,11 @@ export function restore(
   opts?: { scrollToContent: boolean },
 ): DataState {
   const elements = savedElements
-    .filter(el => !isInvisiblySmallElement(el))
+    .filter(el => {
+      // filtering out selection, which is legacy, no longer kept in elements,
+      //  and causing issues if retained
+      return el.type !== "selection" && !isInvisiblySmallElement(el);
+    })
     .map(element => {
       let points: Point[] = [];
       if (element.type === "arrow") {