fix(compiler-core): fix svg with directives being incorrectly hoisted (#5919)

fix #5289
This commit is contained in:
Travis
2022-05-23 09:40:53 +08:00
committed by GitHub
parent 3bdc41dff3
commit 7fbc933f4d
3 changed files with 39 additions and 0 deletions

View File

@@ -230,6 +230,15 @@ export function getConstantType(
// static then they don't need to be blocks since there will be no
// nested updates.
if (codegenNode.isBlock) {
// except set custom directives.
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i]
if (p.type === NodeTypes.DIRECTIVE) {
constantCache.set(node, ConstantTypes.NOT_CONSTANT)
return ConstantTypes.NOT_CONSTANT
}
}
context.removeHelper(OPEN_BLOCK)
context.removeHelper(
getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)