File tree 2 files changed +7
-4
lines changed
compiler-core/src/transforms
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export const transformFor = createStructuralDirectiveTransform(
79
79
80
80
const isStableFragment =
81
81
forNode . source . type === NodeTypes . SIMPLE_EXPRESSION &&
82
- forNode . source . constType > ConstantTypes . CAN_SKIP_PATCH
82
+ forNode . source . constType > ConstantTypes . NOT_CONSTANT
83
83
const fragmentFlag = isStableFragment
84
84
? PatchFlags . STABLE_FRAGMENT
85
85
: keyProp
Original file line number Diff line number Diff line change @@ -1036,12 +1036,15 @@ function walkDeclaration(
1036
1036
)
1037
1037
if ( id . type === 'Identifier' ) {
1038
1038
let bindingType
1039
- if (
1039
+ const userReactiveBinding = userImportAlias [ 'reactive' ] || 'reactive'
1040
+ if ( isCallOf ( init , userReactiveBinding ) ) {
1041
+ // treat reactive() calls as let since it's meant to be mutable
1042
+ bindingType = BindingTypes . SETUP_LET
1043
+ } else if (
1040
1044
// if a declaration is a const literal, we can mark it so that
1041
1045
// the generated render fn code doesn't need to unref() it
1042
1046
isDefineCall ||
1043
- ( isConst &&
1044
- canNeverBeRef ( init ! , userImportAlias [ 'reactive' ] || 'reactive' ) )
1047
+ ( isConst && canNeverBeRef ( init ! , userReactiveBinding ) )
1045
1048
) {
1046
1049
bindingType = BindingTypes . SETUP_CONST
1047
1050
} else if ( isConst ) {
You can’t perform that action at this time.
0 commit comments