wip: disable time-slicing in compat mode
This commit is contained in:
parent
132da6c354
commit
d39eb6cdbc
@ -271,29 +271,7 @@ export function createRenderer(options: RendererOptions) {
|
||||
const doMount = () => {
|
||||
handle.runner = autorun(
|
||||
() => {
|
||||
if (handle.prevTree) {
|
||||
// mounted
|
||||
const { prevTree, current } = handle
|
||||
if (__DEV__) {
|
||||
pushWarningContext(current)
|
||||
}
|
||||
const nextTree = (handle.prevTree = current.children = renderFunctionalRoot(
|
||||
current
|
||||
))
|
||||
queuePostCommitHook(() => {
|
||||
current.el = nextTree.el
|
||||
})
|
||||
patch(
|
||||
prevTree as MountedVNode,
|
||||
nextTree,
|
||||
platformParentNode(current.el),
|
||||
current as MountedVNode,
|
||||
isSVG
|
||||
)
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
} else {
|
||||
if (!handle.prevTree) {
|
||||
// initial mount
|
||||
if (__DEV__) {
|
||||
pushWarningContext(vnode)
|
||||
@ -308,6 +286,8 @@ export function createRenderer(options: RendererOptions) {
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
} else {
|
||||
updateFunctionalComponent(handle, isSVG)
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -324,6 +304,30 @@ export function createRenderer(options: RendererOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateFunctionalComponent(handle: FunctionalHandle, isSVG: boolean) {
|
||||
// mounted
|
||||
const { prevTree, current } = handle
|
||||
if (__DEV__) {
|
||||
pushWarningContext(current)
|
||||
}
|
||||
const nextTree = (handle.prevTree = current.children = renderFunctionalRoot(
|
||||
current
|
||||
))
|
||||
queuePostCommitHook(() => {
|
||||
current.el = nextTree.el
|
||||
})
|
||||
patch(
|
||||
prevTree as MountedVNode,
|
||||
nextTree,
|
||||
platformParentNode(current.el),
|
||||
current as MountedVNode,
|
||||
isSVG
|
||||
)
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
}
|
||||
|
||||
function mountText(
|
||||
vnode: VNode,
|
||||
container: RenderNode | null,
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user