File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 55 Ref ,
66 ComputedRef ,
77 ReactiveEffectOptions ,
8- isReactive
8+ isReactive ,
9+ pauseTracking ,
10+ resetTracking
911} from '@vue/reactivity'
1012import { SchedulerJob , queuePreFlushCb } from './scheduler'
1113import {
@@ -249,6 +251,9 @@ function doWatch(
249251 // watch(source, cb)
250252 const newValue = runner ( )
251253 if ( deep || forceTrigger || hasChanged ( newValue , oldValue ) ) {
254+ // ref #2728
255+ // disable deps collection in watch callbacks
256+ pauseTracking ( )
252257 // cleanup before running cb again
253258 if ( cleanup ) {
254259 cleanup ( )
@@ -259,6 +264,7 @@ function doWatch(
259264 oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue ,
260265 onInvalidate
261266 ] )
267+ resetTracking ( )
262268 oldValue = newValue
263269 }
264270 } else {
You can’t perform that action at this time.
0 commit comments