wip: disable time-slicing in compat mode

This commit is contained in:
Evan You
2018-11-08 18:41:04 -05:00
parent 132da6c354
commit d39eb6cdbc
2 changed files with 36 additions and 28 deletions

View File

@@ -32,7 +32,7 @@ function flushAfterMicroTask() {
}
// Macrotask for time slicing
const key = `__vueSchedulerTick`
const key = `$vueTick`
window.addEventListener(
'message',
@@ -127,9 +127,11 @@ function flush(): void {
} else {
break
}
const now = getNow()
if (now - start > frameBudget && job.expiration > now) {
break
if (!__COMPAT__) {
const now = getNow()
if (now - start > frameBudget && job.expiration > now) {
break
}
}
}
@@ -147,7 +149,7 @@ function flush(): void {
}
// some post commit hook triggered more updates...
if (patchQueue.length > 0) {
if (getNow() - start > frameBudget) {
if (!__COMPAT__ && getNow() - start > frameBudget) {
return flushAfterMacroTask()
} else {
// not out of budget yet, flush sync
@@ -162,6 +164,8 @@ function flush(): void {
}
} else {
// got more job to do
// shouldn't reach here in compat mode, because the patchQueue is
// guarunteed to be drained
flushAfterMacroTask()
}
}