chore: couple minor fixes

Signed-off-by: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
bcakmakoglu
2022-02-21 20:25:17 +01:00
committed by Braks
parent 3518e1dab2
commit b7abb31c24
5 changed files with 15 additions and 26 deletions
@@ -14,7 +14,7 @@ const props = withDefaults(defineProps<MiniMapProps>(), {
maskColor: 'rgb(240, 242, 243, 0.7)',
})
const attrs = useAttrs()
const attrs: Record<string, any> = useAttrs()
const window = useWindow()
const defaultWidth = 200
+1 -7
View File
@@ -11,7 +11,7 @@ export default <N = any, E = N>(options?: Partial<FlowOptions<N, E>>): UseVueFlo
let vueFlow: UseVueFlow | null = scope ? inject(VueFlow, null) ?? (scope.vueFlow as UseVueFlow) : null
if (!vueFlow || (vueFlow && options?.id && options.id !== vueFlow.id)) {
const name = options?.id ?? `vue-flow-${id++}`
let store: Store = useStore(options)
const store: Store = useStore(options)
vueFlow = {
id: name,
store: reactive(store),
@@ -25,12 +25,6 @@ export default <N = any, E = N>(options?: Partial<FlowOptions<N, E>>): UseVueFlo
provide(VueFlow, vueFlow)
scope.vueFlow = vueFlow
}
onScopeDispose(() => {
vueFlow = null as UseVueFlow
scope.vueFlow = null as UseVueFlow
store = null as Store
})
}
if (!vueFlow) throw new Error('VueFlow instance not found.')
+2 -2
View File
@@ -33,7 +33,7 @@ export default (
if (v && Array.isArray(v)) {
pause()
store.setNodes(v)
if (nodes) nodes = store.nodes
if (nodes) nodes.value = store.nodes
await nextTick()
resume()
}
@@ -44,7 +44,7 @@ export default (
if (v && Array.isArray(v)) {
pause()
store.setEdges(v)
if (edges) edges = store.edges
if (edges) edges.value = store.edges
await nextTick()
resume()
}