fix(core): generate fragment root with patchFlag + optimize fragment w/ patchFlag
This commit is contained in:
parent
efe39db023
commit
ef50c333ce
@ -18,7 +18,13 @@ import {
|
|||||||
CacheExpression,
|
CacheExpression,
|
||||||
createCacheExpression
|
createCacheExpression
|
||||||
} from './ast'
|
} from './ast'
|
||||||
import { isString, isArray, NOOP } from '@vue/shared'
|
import {
|
||||||
|
isString,
|
||||||
|
isArray,
|
||||||
|
NOOP,
|
||||||
|
PatchFlags,
|
||||||
|
PatchFlagNames
|
||||||
|
} from '@vue/shared'
|
||||||
import { defaultOnError } from './errors'
|
import { defaultOnError } from './errors'
|
||||||
import {
|
import {
|
||||||
TO_STRING,
|
TO_STRING,
|
||||||
@ -283,7 +289,10 @@ function finalizeRoot(root: RootNode, context: TransformContext) {
|
|||||||
createCallExpression(helper(CREATE_BLOCK), [
|
createCallExpression(helper(CREATE_BLOCK), [
|
||||||
helper(FRAGMENT),
|
helper(FRAGMENT),
|
||||||
`null`,
|
`null`,
|
||||||
root.children
|
root.children,
|
||||||
|
`${PatchFlags.UNKEYED_FRAGMENT} /* ${
|
||||||
|
PatchFlagNames[PatchFlags.UNKEYED_FRAGMENT]
|
||||||
|
} */`
|
||||||
]),
|
]),
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
|
@ -79,7 +79,7 @@ export const transformFor = createStructuralDirectiveTransform(
|
|||||||
helper(FRAGMENT),
|
helper(FRAGMENT),
|
||||||
`null`,
|
`null`,
|
||||||
renderExp,
|
renderExp,
|
||||||
fragmentFlag + (__DEV__ ? ` /* ${PatchFlagNames[fragmentFlag]} */` : ``)
|
`${fragmentFlag} /* ${PatchFlagNames[fragmentFlag]} */`
|
||||||
])
|
])
|
||||||
]) as ForCodegenNode
|
]) as ForCodegenNode
|
||||||
|
|
||||||
|
@ -1033,6 +1033,7 @@ export function createRenderer<
|
|||||||
}
|
}
|
||||||
// fast path
|
// fast path
|
||||||
if (patchFlag > 0) {
|
if (patchFlag > 0) {
|
||||||
|
optimized = true
|
||||||
if (patchFlag & PatchFlags.KEYED_FRAGMENT) {
|
if (patchFlag & PatchFlags.KEYED_FRAGMENT) {
|
||||||
// this could be either fully-keyed or mixed (some keyed some not)
|
// this could be either fully-keyed or mixed (some keyed some not)
|
||||||
// presence of patchFlag means children are guaranteed to be arrays
|
// presence of patchFlag means children are guaranteed to be arrays
|
||||||
|
Loading…
x
Reference in New Issue
Block a user