diff --git a/src/composables/useVueFlow.ts b/src/composables/useVueFlow.ts index e874d2a0..b8fd6b48 100644 --- a/src/composables/useVueFlow.ts +++ b/src/composables/useVueFlow.ts @@ -66,8 +66,10 @@ export default (options?: Partial>): 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 } diff --git a/src/container/VueFlow/watch.ts b/src/container/VueFlow/watch.ts index e2b4b7cd..04276415 100644 --- a/src/container/VueFlow/watch.ts +++ b/src/container/VueFlow/watch.ts @@ -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, diff --git a/src/store/actions.ts b/src/store/actions.ts index ba3717d4..ea579345 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -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)) (state)[o] = option + if (!skip.includes(o) && isDef(option)) (state)[o] = option }) if (!state.paneReady) until(() => state.d3Zoom)