File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 6
6
ReactiveEffect ,
7
7
isReactive ,
8
8
ReactiveFlags ,
9
- EffectScheduler ,
10
9
DebuggerOptions ,
11
10
getCurrentScope
12
11
} from '@vue/reactivity'
@@ -364,19 +363,22 @@ function doWatch(
364
363
// it is allowed to self-trigger (#1727)
365
364
job . allowRecurse = ! ! cb
366
365
367
- let scheduler : EffectScheduler
366
+ let schedulerJob : SchedulerJob
368
367
if ( flush === 'sync' ) {
369
- scheduler = onScheduled => onScheduled ( job as any ) // the scheduler function gets called directly
368
+ schedulerJob = job // the scheduler function gets called directly
370
369
} else if ( flush === 'post' ) {
371
- scheduler = ( ) => queuePostRenderEffect ( job , instance && instance . suspense )
370
+ schedulerJob = ( ) =>
371
+ queuePostRenderEffect ( job , instance && instance . suspense )
372
372
} else {
373
373
// default: 'pre'
374
374
job . pre = true
375
375
if ( instance ) job . id = instance . uid
376
- scheduler = ( ) => queueJob ( job )
376
+ schedulerJob = ( ) => queueJob ( job )
377
377
}
378
378
379
- const effect = new ReactiveEffect ( getter , scheduler )
379
+ const effect = new ReactiveEffect ( getter , onScheduled => {
380
+ onScheduled ( schedulerJob as any )
381
+ } )
380
382
381
383
const unwatch = ( ) => {
382
384
effect . stop ( )
Original file line number Diff line number Diff line change @@ -1545,9 +1545,10 @@ function baseCreateRenderer(
1545
1545
}
1546
1546
1547
1547
// create reactive effect for rendering
1548
+ const schedulerJob = ( ) => queueJob ( update )
1548
1549
const effect = ( instance . effect = new ReactiveEffect (
1549
1550
componentUpdateFn ,
1550
- ( ) => queueJob ( update ) ,
1551
+ onScheduled => onScheduled ( schedulerJob ) ,
1551
1552
instance . scope // track it in component's effect scope
1552
1553
) )
1553
1554
You can’t perform that action at this time.
0 commit comments