From 8fbb1cf505ada13fcf6a598fb5f73ee3ee955624 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 9 Apr 2022 16:59:53 +0200 Subject: [PATCH] update(types): Connection target and source as non-nullable strings * Required for a valid edge, so it should be required in a connection as well --- package/src/composables/useHandle.ts | 4 ++-- package/src/types/connection.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/src/composables/useHandle.ts b/package/src/composables/useHandle.ts index 99bcb888..43bf0e11 100644 --- a/package/src/composables/useHandle.ts +++ b/package/src/composables/useHandle.ts @@ -26,7 +26,7 @@ export const checkElementBelowIsValid = ( const result: Result = { elementBelow, isValid: false, - connection: { source: null, target: null, sourceHandle: null, targetHandle: null }, + connection: { source: '', target: '', sourceHandle: null, targetHandle: null }, isHoveringHandle: false, } @@ -55,7 +55,7 @@ export const checkElementBelowIsValid = ( } result.connection = connection - result.isValid = isValidConnection(connection) + result.isValid = isValidConnection(connection) || !result.connection.target || !result.connection.source } } diff --git a/package/src/types/connection.ts b/package/src/types/connection.ts index 881f9889..96c00ff5 100644 --- a/package/src/types/connection.ts +++ b/package/src/types/connection.ts @@ -14,9 +14,9 @@ export enum ConnectionLineType { /** Connection params that are passed when onConnect is called */ export interface Connection { /** Source node id */ - source: string | null + source: string /** Target node id */ - target: string | null + target: string /** Source handle id */ sourceHandle: string | null /** Target handle id */