]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor: use more generic scope dispose
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 8 Nov 2022 20:46:01 +0000 (21:46 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 8 Nov 2022 20:46:01 +0000 (21:46 +0100)
packages/pinia/src/subscriptions.ts

index 6dc46bb192d6f7ef7645bee1258c16a6670bc198..876966d6316404e590c775faa22bbf09a213356f 100644 (file)
@@ -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<T extends _Method>(
     }
   }
 
-  if (!detached && getCurrentInstance()) {
-    onUnmounted(removeSubscription)
+  if (!detached && getCurrentScope()) {
+    onScopeDispose(removeSubscription)
   }
 
   return removeSubscription