From 84adeb7e392d45c1f1e3bf9cae5e46e93abb8e8b Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Thu, 3 Nov 2022 09:04:01 +0100 Subject: [PATCH] fix(core,nodes): always set a handle id --- packages/core/src/components/Handle/Handle.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/components/Handle/Handle.vue b/packages/core/src/components/Handle/Handle.vue index d1c3519e..3c96e86b 100644 --- a/packages/core/src/components/Handle/Handle.vue +++ b/packages/core/src/components/Handle/Handle.vue @@ -6,7 +6,7 @@ import { ConnectionMode } from '../../types' import type { HandleProps } from '../../types/handle' import { getDimensions } from '../../utils' -const { position = 'top' as Position, connectable = true, id, isValidConnection, ...props } = defineProps() +const { position = 'top' as Position, connectable, id, isValidConnection, ...props } = defineProps() const type = toRef(props, 'type', 'source') @@ -16,7 +16,7 @@ const { id: nodeId, node, nodeEl, connectedEdges } = useNode() const handle = ref() -const handleId = $computed(() => id ?? (connectionMode === ConnectionMode.Strict ? null : `${nodeId}__handle-${position}`)) +const handleId = $computed(() => id ?? `${nodeId}__handle-${position}`) const { onMouseDown, onClick } = useHandle({ nodeId, @@ -35,10 +35,11 @@ const isConnectable = computed(() => { return connectable(node, connectedEdges.value) } - return connectable + return connectable || true }) onMounted(() => { + // set up handle bounds if they don't exist yet (i.e. the handle was added after the node has already been mounted) const existingBounds = node.handleBounds[type.value]?.find((b) => b.id === handleId) if (!vueFlowRef || existingBounds) return