File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/core/src/composables Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,11 @@ import type { GraphNode, Node } from '../types'
4
4
import { warn } from '../utils'
5
5
import { useVueFlow } from './useVueFlow'
6
6
7
- type NodeData < NodeType extends Node = GraphNode > = NonNullable < NodeType [ 'data' ] > & { id : string ; type : NodeType [ 'type' ] }
7
+ interface NodeData < NodeType extends Node = GraphNode > {
8
+ id : string
9
+ type : NodeType [ 'type' ]
10
+ data : NonNullable < NodeType [ 'data' ] > | null
11
+ }
8
12
9
13
/**
10
14
* Composable for receiving data of one or multiple nodes
@@ -38,14 +42,14 @@ export function useNodesData(_nodeIds: any): any {
38
42
return {
39
43
id : node . id ,
40
44
type : node . type ,
41
- data : node . data ,
45
+ data : node . data ?? null ,
42
46
}
43
47
}
44
48
45
49
return null
46
50
}
47
51
48
- const data = [ ]
52
+ const data : NodeData < Node > [ ] = [ ]
49
53
50
54
for ( const nodeId of nodeIds ) {
51
55
const node = findNode ( nodeId )
@@ -54,7 +58,7 @@ export function useNodesData(_nodeIds: any): any {
54
58
data . push ( {
55
59
id : node . id ,
56
60
type : node . type ,
57
- data : node . data ,
61
+ data : node . data ?? null ,
58
62
} )
59
63
}
60
64
}
You can’t perform that action at this time.
0 commit comments