From: Evan You Date: Tue, 9 Feb 2021 16:57:09 +0000 (-0500) Subject: fix(compiler-core): do not mark v-for as stable on const bindings X-Git-Tag: v3.0.6~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=734c65badd8395a78d7beee1fc960aee418361a0;p=thirdparty%2Fvuejs%2Fcore.git 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 --- diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts index 2d193e6012..5cff0eaea4 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