We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1cb6981 commit d05ea4aCopy full SHA for d05ea4a
packages/reactivity/src/watch.ts
@@ -23,7 +23,7 @@ import {
23
} from './effect'
24
import { isReactive, isShallow } from './reactive'
25
import { type Ref, isRef } from './ref'
26
-import { getCurrentScope } from './effectScope'
+import { getCurrentScope, onScopeDispose } from './effectScope'
27
28
// These errors were transferred from `packages/runtime-core/src/errorHandling.ts`
29
// to @vue/reactivity to allow co-location with the moved base watch logic, hence
@@ -218,9 +218,7 @@ export function watch(
218
remove(scope.cleanups, watchHandle)
219
}
220
221
- if (scope) {
222
- scope.cleanups.push(watchHandle)
223
- }
+ onScopeDispose(watchHandle, true)
224
225
if (once && cb) {
226
const _cb = cb
0 commit comments