From da0fbd1e2848099bca83512b66c0ab5753167278 Mon Sep 17 00:00:00 2001 From: chilingling <26962197+chilingling@users.noreply.github.com> Date: Thu, 9 Nov 2023 01:01:59 -0800 Subject: [PATCH] fix(canvas): fix del key error when nothing is selected (#69) --- packages/canvas/src/components/container/container.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/canvas/src/components/container/container.js b/packages/canvas/src/components/container/container.js index 1bea1dd..e65549f 100644 --- a/packages/canvas/src/components/container/container.js +++ b/packages/canvas/src/components/container/container.js @@ -205,6 +205,10 @@ export const removeNode = ({ parent, node }) => { } export const removeNodeById = (id) => { + if (!id) { + return + } + removeNode(getNode(id, true)) clearSelect() getController().addHistory()