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:
5
.changeset/shiny-pots-wash.md
Normal file
5
.changeset/shiny-pots-wash.md
Normal file
@@ -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'
|
||||
|
||||
export interface UseNodeConnectionsParams {
|
||||
handleType?: MaybeRefOrGetter<HandleType>
|
||||
handleId?: MaybeRefOrGetter<string | null>
|
||||
nodeId?: MaybeRefOrGetter<string | null>
|
||||
handleType?: MaybeRefOrGetter<HandleType | null | undefined>
|
||||
handleId?: MaybeRefOrGetter<string | null | undefined>
|
||||
nodeId?: MaybeRefOrGetter<string | null | undefined>
|
||||
onConnect?: (connections: NodeConnection[]) => void
|
||||
onDisconnect?: (connections: NodeConnection[]) => void
|
||||
}
|
||||
@@ -42,9 +42,12 @@ export function useNodeConnections(params: UseNodeConnectionsParams = {}) {
|
||||
const currentHandleType = toValue(handleType)
|
||||
const currHandleId = toValue(handleId)
|
||||
|
||||
return `${currNodeId}${
|
||||
currentHandleType ? (currHandleId ? `-${currentHandleType}-${currHandleId}` : `-${currentHandleType}`) : ''
|
||||
}`
|
||||
let handleSuffix = ''
|
||||
if (currentHandleType) {
|
||||
handleSuffix = currHandleId ? `-${currentHandleType}-${currHandleId}` : `-${currentHandleType}`
|
||||
}
|
||||
|
||||
return `${currNodeId}${handleSuffix}`
|
||||
})
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user