Explorar o código

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

fix #3100
Evan You %!s(int64=5) %!d(string=hai) anos
pai
achega
da944cb379
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      packages/runtime-core/src/componentRenderUtils.ts

+ 3 - 1
packages/runtime-core/src/componentRenderUtils.ts

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