fix(core): prevent undefined being passed to update node internals

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-24 20:07:13 +01:00
committed by Braks
parent cd9b70ff77
commit c4b4826a1a
+5 -1
View File
@@ -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)