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:
Evan You 2021-02-09 11:57:09 -05:00
parent ec8fd10cec
commit 734c65badd

View File

@ -23,7 +23,8 @@ import {
VNodeCall,
ForRenderListExpression,
BlockCodegenNode,
ForIteratorExpression
ForIteratorExpression,
ConstantTypes
} from '../ast'
import { createCompilerError, ErrorCodes } from '../errors'
import {
@ -78,7 +79,7 @@ export const transformFor = createStructuralDirectiveTransform(
const isStableFragment =
forNode.source.type === NodeTypes.SIMPLE_EXPRESSION &&
forNode.source.constType > 0
forNode.source.constType > ConstantTypes.CAN_SKIP_PATCH
const fragmentFlag = isStableFragment
? PatchFlags.STABLE_FRAGMENT
: keyProp