diff --git a/src/composables/useVueFlow.ts b/src/composables/useVueFlow.ts index b8fd6b48..d04ca04f 100644 --- a/src/composables/useVueFlow.ts +++ b/src/composables/useVueFlow.ts @@ -48,7 +48,7 @@ type Scope = EffectScope & { vueFlowId: string } export default (options?: Partial>): UseVueFlow => { const storage = Storage.getInstance() const scope = getCurrentScope() as Scope - let vueFlow = + let vueFlow: UseVueFlow | null | undefined = typeof inject(VueFlow, undefined) !== 'undefined' ? inject(VueFlow, undefined)! : scope && scope.vueFlowId @@ -65,6 +65,7 @@ export default (options?: Partial>): UseVueFlo onScopeDispose(() => { storage.remove(name) + vueFlow = null }) } else { if (options) vueFlow.setState(options)