mirror of https://github.com/vuejs/core.git
fix(compiler-core): add cache flag for createTextVNode
This commit is contained in:
parent
347ef1d3f5
commit
4cb6a4f797
|
@ -60,7 +60,7 @@ return function render(_ctx, _cache) {
|
||||||
|
|
||||||
return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
|
return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
|
||||||
_createElementVNode("span", null, null, -1 /* CACHED */),
|
_createElementVNode("span", null, null, -1 /* CACHED */),
|
||||||
_createTextVNode("foo"),
|
_createTextVNode("foo", -1 /* CACHED */),
|
||||||
_createElementVNode("div", null, null, -1 /* CACHED */)
|
_createElementVNode("div", null, null, -1 /* CACHED */)
|
||||||
])))
|
])))
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,13 @@ import {
|
||||||
getVNodeHelper,
|
getVNodeHelper,
|
||||||
} from '../ast'
|
} from '../ast'
|
||||||
import type { TransformContext } from '../transform'
|
import type { TransformContext } from '../transform'
|
||||||
import { PatchFlags, isArray, isString, isSymbol } from '@vue/shared'
|
import {
|
||||||
|
PatchFlagNames,
|
||||||
|
PatchFlags,
|
||||||
|
isArray,
|
||||||
|
isString,
|
||||||
|
isSymbol,
|
||||||
|
} from '@vue/shared'
|
||||||
import { findDir, isSlotOutlet } from '../utils'
|
import { findDir, isSlotOutlet } from '../utils'
|
||||||
import {
|
import {
|
||||||
GUARD_REACTIVE_PROPS,
|
GUARD_REACTIVE_PROPS,
|
||||||
|
@ -109,6 +115,15 @@ function walk(
|
||||||
? ConstantTypes.NOT_CONSTANT
|
? ConstantTypes.NOT_CONSTANT
|
||||||
: getConstantType(child, context)
|
: getConstantType(child, context)
|
||||||
if (constantType >= ConstantTypes.CAN_CACHE) {
|
if (constantType >= ConstantTypes.CAN_CACHE) {
|
||||||
|
if (
|
||||||
|
child.codegenNode.type === NodeTypes.JS_CALL_EXPRESSION &&
|
||||||
|
child.codegenNode.arguments.length > 0
|
||||||
|
) {
|
||||||
|
child.codegenNode.arguments.push(
|
||||||
|
PatchFlags.CACHED +
|
||||||
|
(__DEV__ ? ` /* ${PatchFlagNames[PatchFlags.CACHED]} */` : ``),
|
||||||
|
)
|
||||||
|
}
|
||||||
toCache.push(child)
|
toCache.push(child)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue