feat: experimental time-slicing

This commit is contained in:
Evan You
2018-11-01 06:58:06 +09:00
parent e6be55a498
commit 6ba02827b1
7 changed files with 284 additions and 90 deletions

View File

@@ -40,13 +40,15 @@ const ErrorTypeStrings: Record<number, string> = {
export function handleError(
err: Error,
instance: ComponentInstance | VNode,
instance: ComponentInstance | VNode | null,
type: ErrorTypes
) {
const isFunctional = (instance as VNode)._isVNode
const contextVNode = (isFunctional
? instance
: (instance as ComponentInstance).$parentVNode) as VNode | null
const isFunctional = instance && (instance as VNode)._isVNode
const contextVNode =
instance &&
((isFunctional
? instance
: (instance as ComponentInstance).$parentVNode) as VNode | null)
let cur: ComponentInstance | null = null
if (isFunctional) {
let vnode = instance as VNode | null
@@ -56,10 +58,11 @@ export function handleError(
if (vnode) {
cur = vnode.children as ComponentInstance
}
} else {
} else if (instance) {
cur = (instance as ComponentInstance).$parent
}
while (cur) {
cur = cur._self
const handler = cur.errorCaptured
if (handler) {
try {