From 833cf5e489c7bb2dad125ccbe5fdbb044f61f89d Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 25 Mar 2022 14:01:53 +0100 Subject: [PATCH] update(store): set vueFlow var to null on scope dispose --- src/composables/useVueFlow.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)