Skip to content

Commit

Permalink
fix(compiler-core): do not mark v-for as stable on const bindings
Browse files Browse the repository at this point in the history
since the source value may be a reactive array

fix vitejs/vite#1956
  • Loading branch information
yyx990803 committed Feb 9, 2021
1 parent ec8fd10 commit 734c65b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/compiler-core/src/transforms/vFor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
VNodeCall,
ForRenderListExpression,
BlockCodegenNode,
ForIteratorExpression
ForIteratorExpression,
ConstantTypes
} from '../ast'
import { createCompilerError, ErrorCodes } from '../errors'
import {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 734c65b

Please sign in to comment.