From a7df9019460d8d4394de2e8f1bc07b87b82abb05 Mon Sep 17 00:00:00 2001 From: Gasim Gasimzada Date: Thu, 9 Jan 2020 15:34:04 +0400 Subject: [PATCH] Make `clearSelection` return a new array --- src/scene/selection.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scene/selection.ts b/src/scene/selection.ts index ad11eb356..6347fae8c 100644 --- a/src/scene/selection.ts +++ b/src/scene/selection.ts @@ -30,11 +30,13 @@ export function setSelection( } export function clearSelection(elements: readonly ExcalidrawElement[]) { - elements.forEach(element => { + const newElements = [...elements]; + + newElements.forEach(element => { element.isSelected = false; }); - return elements; + return newElements; } export function deleteSelectedElements(elements: readonly ExcalidrawElement[]) {