From 734c65badd8395a78d7beee1fc960aee418361a0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 9 Feb 2021 11:57:09 -0500 Subject: [PATCH] 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 --- packages/compiler-core/src/transforms/vFor.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts index 2d193e60..5cff0eae 100644 --- a/packages/compiler-core/src/transforms/vFor.ts +++ b/packages/compiler-core/src/transforms/vFor.ts @@ -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