From: Eduardo San Martin Morote Date: Tue, 8 Nov 2022 20:46:01 +0000 (+0100) Subject: refactor: use more generic scope dispose X-Git-Tag: @pinia/nuxt@0.4.4~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57405de56610dcfaa506cb95e557a7c7e4d693a7;p=thirdparty%2Fvuejs%2Fpinia.git refactor: use more generic scope dispose --- diff --git a/packages/pinia/src/subscriptions.ts b/packages/pinia/src/subscriptions.ts index 6dc46bb1..876966d6 100644 --- a/packages/pinia/src/subscriptions.ts +++ b/packages/pinia/src/subscriptions.ts @@ -1,4 +1,4 @@ -import { getCurrentInstance, onUnmounted } from 'vue-demi' +import { getCurrentScope, onScopeDispose } from 'vue-demi' import { _Method } from './types' export const noop = () => {} @@ -19,8 +19,8 @@ export function addSubscription( } } - if (!detached && getCurrentInstance()) { - onUnmounted(removeSubscription) + if (!detached && getCurrentScope()) { + onScopeDispose(removeSubscription) } return removeSubscription