fix(compiler-core): do not mark v-for as stable on const bindings
since the source value may be a reactive array fix vitejs/vite#1956
This commit is contained in:
parent
ec8fd10cec
commit
734c65badd
@ -23,7 +23,8 @@ import {
|
|||||||
VNodeCall,
|
VNodeCall,
|
||||||
ForRenderListExpression,
|
ForRenderListExpression,
|
||||||
BlockCodegenNode,
|
BlockCodegenNode,
|
||||||
ForIteratorExpression
|
ForIteratorExpression,
|
||||||
|
ConstantTypes
|
||||||
} from '../ast'
|
} from '../ast'
|
||||||
import { createCompilerError, ErrorCodes } from '../errors'
|
import { createCompilerError, ErrorCodes } from '../errors'
|
||||||
import {
|
import {
|
||||||
@ -78,7 +79,7 @@ export const transformFor = createStructuralDirectiveTransform(
|
|||||||
|
|
||||||
const isStableFragment =
|
const isStableFragment =
|
||||||
forNode.source.type === NodeTypes.SIMPLE_EXPRESSION &&
|
forNode.source.type === NodeTypes.SIMPLE_EXPRESSION &&
|
||||||
forNode.source.constType > 0
|
forNode.source.constType > ConstantTypes.CAN_SKIP_PATCH
|
||||||
const fragmentFlag = isStableFragment
|
const fragmentFlag = isStableFragment
|
||||||
? PatchFlags.STABLE_FRAGMENT
|
? PatchFlags.STABLE_FRAGMENT
|
||||||
: keyProp
|
: keyProp
|
||||||
|
Loading…
Reference in New Issue
Block a user