From 84c2f6df99b3cd7b220cab27d20fee3c9f29e7e4 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 3 Feb 2024 11:54:12 +0100 Subject: [PATCH] refactor(core): find handle by id regardless of num of handles --- packages/core/src/utils/edge.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/core/src/utils/edge.ts b/packages/core/src/utils/edge.ts index a1c239e3..812849d0 100644 --- a/packages/core/src/utils/edge.ts +++ b/packages/core/src/utils/edge.ts @@ -37,13 +37,7 @@ export function getHandle(bounds: HandleElement[] = [], handleId?: string | null return null } - if (!handleId || bounds.length === 1) { - return bounds[0] - } else if (handleId) { - return bounds.find((d) => d.id === handleId) || null - } - - return null + return (!handleId ? bounds[0] : bounds.find((d) => d.id === handleId)) || null } export function getEdgePositions(