From 085f71d43527c839c69ae3c0953ddde5ffc94da3 Mon Sep 17 00:00:00 2001 From: moklick Date: Tue, 23 Jan 2024 11:45:26 +0100 Subject: [PATCH] refactor(handles): do not use fallback handle if an id is being used #3409 --- packages/system/src/utils/edges/positions.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/system/src/utils/edges/positions.ts b/packages/system/src/utils/edges/positions.ts index 59b8cd42..8bb9f5df 100644 --- a/packages/system/src/utils/edges/positions.ts +++ b/packages/system/src/utils/edges/positions.ts @@ -114,11 +114,6 @@ function getHandle(bounds: HandleElement[], handleId?: string | null): HandleEle return null; } - if (bounds.length === 1 || !handleId) { - return bounds[0]; - } else if (handleId) { - return bounds.find((d) => d.id === handleId) || null; - } - - return null; + // if no handleId is given, we use the first handle, otherwise we check for the id + return (!handleId ? bounds[0] : bounds.find((d) => d.id === handleId)) || null; }