fix(store): setting store state after init

This commit is contained in:
Braks
2022-04-04 21:42:48 +02:00
parent 4644af5736
commit 188156dd0b
3 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -66,8 +66,10 @@ export default <N = any, E = N>(options?: Partial<FlowOptions<N, E>>): UseVueFlo
onScopeDispose(() => {
storage.remove(name)
})
} else {
if (options) vueFlow.setState(options)
}
if (!vueFlow) throw new Error('VueFlow instance not found.')
if (!vueFlow) throw new Error('vue flow store instance not found.')
return vueFlow
}
+1 -1
View File
@@ -64,7 +64,7 @@ export default (
const skip = ['modelValue', 'edges', 'nodes', 'maxZoom', 'minZoom']
Object.keys(props).forEach((p) => {
if (!skip.indexOf(p)) {
if (!skip.includes(p)) {
const prop = props[p as keyof typeof props]
watch(
() => prop,
+1 -1
View File
@@ -292,7 +292,7 @@ export default (state: State, getters: ComputedGetters): Actions => {
if (typeof opts.edges !== 'undefined') setEdges(opts.edges)
Object.keys(opts).forEach((o) => {
const option = opts[o as keyof typeof opts]
if (!skip.indexOf(o) && isDef(option)) (<any>state)[o] = option
if (!skip.includes(o) && isDef(option)) (<any>state)[o] = option
})
if (!state.paneReady)
until(() => state.d3Zoom)