From a9bd82d28aee64060ed24c61168c511f2fa6b2e1 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:56:51 +0100 Subject: [PATCH] chore(core): cleanup --- packages/core/src/composables/useNode.ts | 2 +- packages/core/src/utils/errors.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/composables/useNode.ts b/packages/core/src/composables/useNode.ts index 40d6ed57..74ef8596 100644 --- a/packages/core/src/composables/useNode.ts +++ b/packages/core/src/composables/useNode.ts @@ -13,7 +13,7 @@ import { useNodeId } from './useNodeId' * Meaning if you do not provide an id, this composable has to be called in a child of your custom node component, or it will throw */ export function useNode = any>(id?: string) { - const nodeId = id ?? useNodeId() + const nodeId = id ?? useNodeId() ?? '' const nodeEl = inject(NodeRef, ref(null)) const { findNode, edges, emits } = useVueFlow() diff --git a/packages/core/src/utils/errors.ts b/packages/core/src/utils/errors.ts index 21c6b5a6..60fa8ceb 100644 --- a/packages/core/src/utils/errors.ts +++ b/packages/core/src/utils/errors.ts @@ -18,7 +18,7 @@ export enum ErrorCode { const messages = { [ErrorCode.MISSING_VIEWPORT_DIMENSIONS]: () => 'The Vue Flow parent container needs a width and a height to render the graph', [ErrorCode.NODE_INVALID]: (id?: string) => `Node is invalid\nNode: ${id}`, - [ErrorCode.NODE_NOT_FOUND]: (id: string) => `Node not found\nNode: ${id}`, + [ErrorCode.NODE_NOT_FOUND]: (id: string | null) => `Node not found\nNode: ${id}`, [ErrorCode.NODE_MISSING_PARENT]: (id: string, parentId: string) => `Node is missing a parent\nNode: ${id}\nParent: ${parentId}`, [ErrorCode.NODE_TYPE_MISSING]: (type: string) => `Node type is missing\nType: ${type}`, [ErrorCode.NODE_EXTENT_INVALID]: (id: string) => `Only child nodes can use a parent extent\nNode: ${id}`,