Skip to content

Commit

Permalink
refactor: use more generic scope dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Nov 8, 2022
1 parent 505246e commit 57405de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/pinia/src/subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCurrentInstance, onUnmounted } from 'vue-demi'
import { getCurrentScope, onScopeDispose } from 'vue-demi'
import { _Method } from './types'

export const noop = () => {}
Expand All @@ -19,8 +19,8 @@ export function addSubscription<T extends _Method>(
}
}

if (!detached && getCurrentInstance()) {
onUnmounted(removeSubscription)
if (!detached && getCurrentScope()) {
onScopeDispose(removeSubscription)
}

return removeSubscription
Expand Down

0 comments on commit 57405de

Please sign in to comment.