refactor(core): allow passing null/undefined to use node connection args (#1820)
* refactor(core): allow passing null/undefined to use node connection args Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(core): cleanup Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(changeset): add --------- Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@vue-flow/core": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Allow passing null or undefined to `useNodeConnections` options
|
||||||
@@ -6,9 +6,9 @@ import { useNodeId } from './useNodeId'
|
|||||||
import { useVueFlow } from './useVueFlow'
|
import { useVueFlow } from './useVueFlow'
|
||||||
|
|
||||||
export interface UseNodeConnectionsParams {
|
export interface UseNodeConnectionsParams {
|
||||||
handleType?: MaybeRefOrGetter<HandleType>
|
handleType?: MaybeRefOrGetter<HandleType | null | undefined>
|
||||||
handleId?: MaybeRefOrGetter<string | null>
|
handleId?: MaybeRefOrGetter<string | null | undefined>
|
||||||
nodeId?: MaybeRefOrGetter<string | null>
|
nodeId?: MaybeRefOrGetter<string | null | undefined>
|
||||||
onConnect?: (connections: NodeConnection[]) => void
|
onConnect?: (connections: NodeConnection[]) => void
|
||||||
onDisconnect?: (connections: NodeConnection[]) => void
|
onDisconnect?: (connections: NodeConnection[]) => void
|
||||||
}
|
}
|
||||||
@@ -42,9 +42,12 @@ export function useNodeConnections(params: UseNodeConnectionsParams = {}) {
|
|||||||
const currentHandleType = toValue(handleType)
|
const currentHandleType = toValue(handleType)
|
||||||
const currHandleId = toValue(handleId)
|
const currHandleId = toValue(handleId)
|
||||||
|
|
||||||
return `${currNodeId}${
|
let handleSuffix = ''
|
||||||
currentHandleType ? (currHandleId ? `-${currentHandleType}-${currHandleId}` : `-${currentHandleType}`) : ''
|
if (currentHandleType) {
|
||||||
}`
|
handleSuffix = currHandleId ? `-${currentHandleType}-${currHandleId}` : `-${currentHandleType}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${currNodeId}${handleSuffix}`
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
Reference in New Issue
Block a user