Skip to content

Commit

Permalink
chore(docs): cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
  • Loading branch information
bcakmakoglu committed Jan 7, 2025
1 parent 7a6e6d4 commit 385e055
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/examples/custom-node/OutputNode.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import { Handle, Position, useHandleConnections, useNodesData } from '@vue-flow/core'
import { Handle, Position, useNodeConnections, useNodesData } from '@vue-flow/core'
const connections = useHandleConnections({
const connections = useNodeConnections({
type: 'target',
})
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/layout/ProcessNode.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { computed, toRef } from 'vue'
import { Handle, useHandleConnections } from '@vue-flow/core'
import { Handle, useNodeConnections } from '@vue-flow/core'
const props = defineProps({
data: {
Expand All @@ -15,11 +15,11 @@ const props = defineProps({
},
})
const sourceConnections = useHandleConnections({
const sourceConnections = useNodeConnections({
type: 'target',
})
const targetConnections = useHandleConnections({
const targetConnections = useNodeConnections({
type: 'source',
})
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/math/ResultNode.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { computed } from 'vue'
import { Handle, Position, useHandleConnections, useNodeConnections, useNodesData } from '@vue-flow/core'
import { Handle, Position, useNodeConnections, useNodesData } from '@vue-flow/core'
defineProps(['id'])
Expand All @@ -12,7 +12,7 @@ const mathFunctions = {
}
// Get the source connections of the result node. In this example it's only one operator node.
const sourceConnections = useHandleConnections({
const sourceConnections = useNodeConnections({
// type target means all connections where *this* node is the target
// that means we go backwards in the graph to find the source of the connection(s)
type: 'target',
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/math.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Math Operation

This example demonstrates how to use the different composables like `useHandleConnections` or `useNodesData` to create a data flow between nodes.
This example demonstrates how to use the different composables like `useNodeConnections` or `useNodesData` to create a data flow between nodes.

In this example we use nodes to create a simple math operation, where the user can input two numbers and select an operation to perform.
We use nodes to create a simple math operation, where the user can input two numbers and select an operation to perform.

<div class="mt-6">
<Repl example="math"></Repl>
Expand Down
7 changes: 5 additions & 2 deletions docs/src/guide/composables.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ const connections = useHandleConnections({
## [useNodeConnections](/typedocs/functions/useNodeConnections)

`useNodeConnections` provides you with an array of connections that are connected to a specific node.
This composable is especially useful when you want to get all connections (of either type `source` or `target`) of a node
instead of just the connections of a specific `<Handle>`.
This composable is especially useful when you want to get all connections (of either type `source` or `target`) of a node.

```ts
import { type HandleConnection, useNodeConnections } from '@vue-flow/core'
Expand All @@ -119,6 +118,10 @@ const sourceConnections = useNodeConnections({
type: 'source',
})

const handleConnections = useNodeConnections({
handleId: 'handle-1', // you can explicitly pass a handle id if you want to get connections of a specific handle
})

const connections = useNodeConnections({
nodeId: '1', // you can explicitly pass a node id, otherwise it's used from the `NodeId injection
type: 'target',
Expand Down

0 comments on commit 385e055

Please sign in to comment.