From 13b838117ca8a24a39e211e8bbbb6a314cae7e90 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Tue, 10 Mar 2020 19:41:41 +0100 Subject: [PATCH] filter out selection elements on restore (#901) * filter out selection elements on restore * add comment --- src/data/restore.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/data/restore.ts b/src/data/restore.ts index 950a5647..4ff3765f 100644 --- a/src/data/restore.ts +++ b/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") {