fix(store): setting store state after init
This commit is contained in:
@@ -66,8 +66,10 @@ export default <N = any, E = N>(options?: Partial<FlowOptions<N, E>>): UseVueFlo
|
|||||||
onScopeDispose(() => {
|
onScopeDispose(() => {
|
||||||
storage.remove(name)
|
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
|
return vueFlow
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export default (
|
|||||||
|
|
||||||
const skip = ['modelValue', 'edges', 'nodes', 'maxZoom', 'minZoom']
|
const skip = ['modelValue', 'edges', 'nodes', 'maxZoom', 'minZoom']
|
||||||
Object.keys(props).forEach((p) => {
|
Object.keys(props).forEach((p) => {
|
||||||
if (!skip.indexOf(p)) {
|
if (!skip.includes(p)) {
|
||||||
const prop = props[p as keyof typeof props]
|
const prop = props[p as keyof typeof props]
|
||||||
watch(
|
watch(
|
||||||
() => prop,
|
() => prop,
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ export default (state: State, getters: ComputedGetters): Actions => {
|
|||||||
if (typeof opts.edges !== 'undefined') setEdges(opts.edges)
|
if (typeof opts.edges !== 'undefined') setEdges(opts.edges)
|
||||||
Object.keys(opts).forEach((o) => {
|
Object.keys(opts).forEach((o) => {
|
||||||
const option = opts[o as keyof typeof opts]
|
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)
|
if (!state.paneReady)
|
||||||
until(() => state.d3Zoom)
|
until(() => state.d3Zoom)
|
||||||
|
|||||||
Reference in New Issue
Block a user