fix(ssr): fix memory leak when vnode component render throws error

fix #3100
This commit is contained in:
Evan You 2021-03-25 18:04:21 -04:00
parent 2b588cf1bc
commit da944cb379

View File

@ -10,7 +10,8 @@ import {
Comment, Comment,
cloneVNode, cloneVNode,
VNodeArrayChildren, VNodeArrayChildren,
isVNode isVNode,
blockStack
} from './vnode' } from './vnode'
import { handleError, ErrorCodes } from './errorHandling' import { handleError, ErrorCodes } from './errorHandling'
import { PatchFlags, ShapeFlags, isOn, isModelListener } from '@vue/shared' import { PatchFlags, ShapeFlags, isOn, isModelListener } from '@vue/shared'
@ -201,6 +202,7 @@ export function renderComponentRoot(
result = root result = root
} }
} catch (err) { } catch (err) {
blockStack.length = 0
handleError(err, instance, ErrorCodes.RENDER_FUNCTION) handleError(err, instance, ErrorCodes.RENDER_FUNCTION)
result = createVNode(Comment) result = createVNode(Comment)
} }