refactor(runtime-core/scheduler): dedicated preFlush queue

properly fix #1763, #1777, #1781
This commit is contained in:
Evan You
2020-08-05 10:55:23 -04:00
parent 74a1265fea
commit 3692f2738f
4 changed files with 212 additions and 64 deletions

View File

@@ -7,7 +7,7 @@ import {
ReactiveEffectOptions,
isReactive
} from '@vue/reactivity'
import { queueJob, SchedulerJob } from './scheduler'
import { SchedulerJob, queuePreFlushCb } from './scheduler'
import {
EMPTY_OBJ,
isObject,
@@ -271,7 +271,7 @@ function doWatch(
job.id = -1
scheduler = () => {
if (!instance || instance.isMounted) {
queueJob(job)
queuePreFlushCb(job)
} else {
// with 'pre' option, the first call must happen before
// the component is mounted so it is called synchronously.