File tree 1 file changed +18
-2
lines changed
packages/runtime-core/src
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,15 @@ export function setRef(
115
115
} else {
116
116
if ( ! isArray ( existing ) ) {
117
117
if ( _isString ) {
118
- if ( oldRef !== ref ) {
118
+ if ( oldRef === ref ) {
119
+ if ( __DEV__ ) {
120
+ warn (
121
+ 'Duplicate template ref detected:' ,
122
+ ref ,
123
+ `(${ typeof ref } ). Ref names must be unique within the same scope.` ,
124
+ )
125
+ }
126
+ } else {
119
127
refs [ ref ] = [ refValue ]
120
128
if ( canSetSetupRef ( ref ) ) {
121
129
setupState [ ref ] = refs [ ref ]
@@ -130,7 +138,15 @@ export function setRef(
130
138
}
131
139
}
132
140
} else if ( _isString ) {
133
- if ( oldRef !== ref ) {
141
+ if ( oldRef === ref ) {
142
+ if ( __DEV__ ) {
143
+ warn (
144
+ 'Duplicate template ref detected:' ,
145
+ ref ,
146
+ `(${ typeof ref } ). Ref names must be unique within the same scope.` ,
147
+ )
148
+ }
149
+ } else {
134
150
refs [ ref ] = value
135
151
if ( canSetSetupRef ( ref ) ) {
136
152
setupState [ ref ] = value
You can’t perform that action at this time.
0 commit comments