File tree 1 file changed +7
-1
lines changed
packages/runtime-core/src
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 5
5
Ref ,
6
6
ComputedRef ,
7
7
ReactiveEffectOptions ,
8
- isReactive
8
+ isReactive ,
9
+ pauseTracking ,
10
+ resetTracking
9
11
} from '@vue/reactivity'
10
12
import { SchedulerJob , queuePreFlushCb } from './scheduler'
11
13
import {
@@ -249,6 +251,9 @@ function doWatch(
249
251
// watch(source, cb)
250
252
const newValue = runner ( )
251
253
if ( deep || forceTrigger || hasChanged ( newValue , oldValue ) ) {
254
+ // ref #2728
255
+ // disable deps collection in watch callbacks
256
+ pauseTracking ( )
252
257
// cleanup before running cb again
253
258
if ( cleanup ) {
254
259
cleanup ( )
@@ -259,6 +264,7 @@ function doWatch(
259
264
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue ,
260
265
onInvalidate
261
266
] )
267
+ resetTracking ( )
262
268
oldValue = newValue
263
269
}
264
270
} else {
You can’t perform that action at this time.
0 commit comments