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 66 ReactiveEffect ,
77 isReactive ,
88 ReactiveFlags ,
9- EffectScheduler ,
109 DebuggerOptions ,
1110 getCurrentScope
1211} from '@vue/reactivity'
@@ -364,19 +363,22 @@ function doWatch(
364363 // it is allowed to self-trigger (#1727)
365364 job . allowRecurse = ! ! cb
366365
367- let scheduler : EffectScheduler
366+ let schedulerJob : SchedulerJob
368367 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
370369 } else if ( flush === 'post' ) {
371- scheduler = ( ) => queuePostRenderEffect ( job , instance && instance . suspense )
370+ schedulerJob = ( ) =>
371+ queuePostRenderEffect ( job , instance && instance . suspense )
372372 } else {
373373 // default: 'pre'
374374 job . pre = true
375375 if ( instance ) job . id = instance . uid
376- scheduler = ( ) => queueJob ( job )
376+ schedulerJob = ( ) => queueJob ( job )
377377 }
378378
379- const effect = new ReactiveEffect ( getter , scheduler )
379+ const effect = new ReactiveEffect ( getter , onScheduled => {
380+ onScheduled ( schedulerJob as any )
381+ } )
380382
381383 const unwatch = ( ) => {
382384 effect . stop ( )
Original file line number Diff line number Diff line change @@ -1545,9 +1545,10 @@ function baseCreateRenderer(
15451545 }
15461546
15471547 // create reactive effect for rendering
1548+ const schedulerJob = ( ) => queueJob ( update )
15481549 const effect = ( instance . effect = new ReactiveEffect (
15491550 componentUpdateFn ,
1550- ( ) => queueJob ( update ) ,
1551+ onScheduled => onScheduled ( schedulerJob ) ,
15511552 instance . scope // track it in component's effect scope
15521553 ) )
15531554
You can’t perform that action at this time.
0 commit comments