Skip to content

Commit d05ea4a

Browse files
edison1105yyx990803
authored andcommitted
chore: update
1 parent 1cb6981 commit d05ea4a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/reactivity/src/watch.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
} from './effect'
2424
import { isReactive, isShallow } from './reactive'
2525
import { type Ref, isRef } from './ref'
26-
import { getCurrentScope } from './effectScope'
26+
import { getCurrentScope, onScopeDispose } from './effectScope'
2727

2828
// These errors were transferred from `packages/runtime-core/src/errorHandling.ts`
2929
// to @vue/reactivity to allow co-location with the moved base watch logic, hence
@@ -218,9 +218,7 @@ export function watch(
218218
remove(scope.cleanups, watchHandle)
219219
}
220220
}
221-
if (scope) {
222-
scope.cleanups.push(watchHandle)
223-
}
221+
onScopeDispose(watchHandle, true)
224222

225223
if (once && cb) {
226224
const _cb = cb

0 commit comments

Comments
 (0)