From c4b4826a1ac0dc60b36e38b252b7266fea89ee4f Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:59:56 +0100 Subject: [PATCH] fix(core): prevent undefined being passed to update node internals Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/core/src/store/actions.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index e0f5b6a8..9fdde9b7 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -28,7 +28,11 @@ export function useActions(state: State, getters: ComputedGetters): Actions { const nodeIds = $computed(() => state.nodes.map((n) => n.id)) const edgeIds = $computed(() => state.edges.map((e) => e.id)) - const updateNodeInternals: Actions['updateNodeInternals'] = (ids) => state.hooks.updateNodeInternals.trigger(ids ?? nodeIds) + const updateNodeInternals: Actions['updateNodeInternals'] = (ids) => { + const updateIds = ids ?? nodeIds ?? [] + + state.hooks.updateNodeInternals.trigger(updateIds) + } const findNode: Actions['findNode'] = (id) => { if (state.nodes && !nodeIds.length) return state.nodes.find((node) => node.id === id)