]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core): do not mark v-for as stable on const bindings
authorEvan You <yyx990803@gmail.com>
Tue, 9 Feb 2021 16:57:09 +0000 (11:57 -0500)
committerEvan You <yyx990803@gmail.com>
Tue, 9 Feb 2021 16:57:09 +0000 (11:57 -0500)
since the source value may be a reactive array

fix vitejs/vite#1956

packages/compiler-core/src/transforms/vFor.ts

index 2d193e6012517d93127fcee240ad09dd2ea938ad..5cff0eaea46849d278f3c496b6081dae2dcd945c 100644 (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