From 7e0e885417e3cee4889d0d0e26b38ae67214c4b5 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Thu, 27 Feb 2020 17:37:43 +0100 Subject: [PATCH] ensure restored elements are normalized before filter (#844) --- src/scene/data.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scene/data.ts b/src/scene/data.ts index 2c037202..521bdad0 100644 --- a/src/scene/data.ts +++ b/src/scene/data.ts @@ -343,7 +343,6 @@ function restore( opts?: { scrollToContent: boolean }, ): DataState { const elements = savedElements - .filter(el => !isInvisiblySmallElement(el)) .map(element => { let points: Point[] = []; if (element.type === "arrow") { @@ -392,7 +391,8 @@ function restore( canvasOffsetX: element.canvasOffsetX || 0, canvasOffsetY: element.canvasOffsetY || 0, }; - }); + }) + .filter(el => !isInvisiblySmallElement(el)); if (opts?.scrollToContent && savedState) { savedState = { ...savedState, ...calculateScrollCenter(elements) };