Skip to content

Commit

Permalink
chore(changeset): add
Browse files Browse the repository at this point in the history
  • Loading branch information
bcakmakoglu committed Feb 4, 2024
1 parent 934c9e6 commit 823956e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .changeset/old-jokes-raise.md
@@ -0,0 +1,46 @@
---
"@vue-flow/core": minor
---

Add `useNodesData` composable

## 馃 Example

### Single node id

```ts
const nodeId = '1'

const data = useNodesData(nodeId)

console.log(data.value) // '[{ /* ... */ }]
```

### Array of node ids
```ts
const nodeIds = ['1', '2', '3']

const data = useNodesData(nodeIds)

console.log(data.value) // '[{ /* ... */ }]
```

### Asserting data type
```ts
import type { Node } from '@vue-flow/core'

interface Data {
foo: string;
bar: string;
}

type MyNode = Node<CustomNodeData>

const nodeId = '1'

const data = useNodesData([nodeId], (node): node is MyNode => {
return 'foo' in node.data && 'bar' in node.data
})

console.log(data.value) // '[{ /* foo: string; bar: string */ }]
```

0 comments on commit 823956e

Please sign in to comment.