diff --git a/packages/compiler-vapor/src/transforms/transformText.ts b/packages/compiler-vapor/src/transforms/transformText.ts index dd81bec1e80..d7ce8207351 100644 --- a/packages/compiler-vapor/src/transforms/transformText.ts +++ b/packages/compiler-vapor/src/transforms/transformText.ts @@ -11,11 +11,7 @@ import { } from '@vue/compiler-dom' import type { NodeTransform, TransformContext } from '../transform' import { DynamicFlag, IRNodeTypes } from '../ir' -import { - getLiteralExpressionValue, - isConstantExpression, - isStaticExpression, -} from '../utils' +import { getLiteralExpressionValue } from '../utils' import { escapeHtml } from '@vue/shared' type TextLike = TextNode | InterpolationNode @@ -62,7 +58,7 @@ export const transformText: NodeTransform = (node, context) => { // all text like with interpolation if (!isFragment && isAllTextLike && hasInterp) { processTextContainer( - node.children as TextLike[], + processTextLikeChildren(node.children as TextLike[], context), context as TransformContext, ) } else if (hasInterp) { @@ -112,35 +108,17 @@ function processInterpolation(context: TransformContext) { return } - const nonConstantExps = values.filter(v => !isConstantExpression(v)) - const isStatic = - !nonConstantExps.length || - nonConstantExps.every(e => - isStaticExpression(e, context.options.bindingMetadata), - ) || - context.inVOnce - - if (isStatic) { - context.registerOperation({ - type: IRNodeTypes.SET_TEXT, - element: id, - values, - }) - } else { - context.registerEffect(values, { - type: IRNodeTypes.SET_TEXT, - element: id, - values, - }) - } + context.registerEffect(values, { + type: IRNodeTypes.SET_TEXT, + element: id, + values, + }) } function processTextContainer( - children: TextLike[], + values: SimpleExpressionNode[], context: TransformContext, -) { - const values = processTextLikeChildren(children, context) - +): void { const literals = values.map(getLiteralExpressionValue) if (literals.every(l => l != null)) {