wip: disable time-slicing in compat mode
This commit is contained in:
parent
132da6c354
commit
d39eb6cdbc
@ -271,7 +271,40 @@ export function createRenderer(options: RendererOptions) {
|
||||
const doMount = () => {
|
||||
handle.runner = autorun(
|
||||
() => {
|
||||
if (handle.prevTree) {
|
||||
if (!handle.prevTree) {
|
||||
// initial mount
|
||||
if (__DEV__) {
|
||||
pushWarningContext(vnode)
|
||||
}
|
||||
const subTree = (handle.prevTree = vnode.children = renderFunctionalRoot(
|
||||
vnode
|
||||
))
|
||||
queuePostCommitHook(() => {
|
||||
vnode.el = subTree.el as RenderNode
|
||||
})
|
||||
mount(subTree, container, vnode as MountedVNode, isSVG, endNode)
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
} else {
|
||||
updateFunctionalComponent(handle, isSVG)
|
||||
}
|
||||
},
|
||||
{
|
||||
scheduler: queueUpdate
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// we are using vnode.ref to store the functional component's update job
|
||||
if (__COMPAT__) {
|
||||
doMount()
|
||||
} else {
|
||||
queueJob(doMount)
|
||||
}
|
||||
}
|
||||
|
||||
function updateFunctionalComponent(handle: FunctionalHandle, isSVG: boolean) {
|
||||
// mounted
|
||||
const { prevTree, current } = handle
|
||||
if (__DEV__) {
|
||||
@ -293,35 +326,6 @@ export function createRenderer(options: RendererOptions) {
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
} else {
|
||||
// initial mount
|
||||
if (__DEV__) {
|
||||
pushWarningContext(vnode)
|
||||
}
|
||||
const subTree = (handle.prevTree = vnode.children = renderFunctionalRoot(
|
||||
vnode
|
||||
))
|
||||
queuePostCommitHook(() => {
|
||||
vnode.el = subTree.el as RenderNode
|
||||
})
|
||||
mount(subTree, container, vnode as MountedVNode, isSVG, endNode)
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
scheduler: queueUpdate
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// we are using vnode.ref to store the functional component's update job
|
||||
if (__COMPAT__) {
|
||||
doMount()
|
||||
} else {
|
||||
queueJob(doMount)
|
||||
}
|
||||
}
|
||||
|
||||
function mountText(
|
||||
|
@ -32,7 +32,7 @@ function flushAfterMicroTask() {
|
||||
}
|
||||
|
||||
// Macrotask for time slicing
|
||||
const key = `__vueSchedulerTick`
|
||||
const key = `$vueTick`
|
||||
|
||||
window.addEventListener(
|
||||
'message',
|
||||
@ -127,11 +127,13 @@ function flush(): void {
|
||||
} else {
|
||||
break
|
||||
}
|
||||
if (!__COMPAT__) {
|
||||
const now = getNow()
|
||||
if (now - start > frameBudget && job.expiration > now) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (patchQueue.length === 0) {
|
||||
// all done, time to commit!
|
||||
@ -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()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user