@@ -60,15 +60,23 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
60
60
items = Object . entries ( items ) . map ( ( [ key , value ] ) => {
61
61
let scope = getIterationScopeVariables ( iteratorNames , value , key , items )
62
62
63
- evaluateKey ( value => keys . push ( value ) , { scope : { index : key , ...scope } } )
63
+ evaluateKey ( value => {
64
+ if ( keys . includes ( value ) ) warn ( 'Duplicate key on x-for' , el )
65
+
66
+ keys . push ( value )
67
+ } , { scope : { index : key , ...scope } } )
64
68
65
69
scopes . push ( scope )
66
70
} )
67
71
} else {
68
72
for ( let i = 0 ; i < items . length ; i ++ ) {
69
73
let scope = getIterationScopeVariables ( iteratorNames , items [ i ] , i , items )
70
74
71
- evaluateKey ( value => keys . push ( value ) , { scope : { index : i , ...scope } } )
75
+ evaluateKey ( value => {
76
+ if ( keys . includes ( value ) ) warn ( 'Duplicate key on x-for' , el )
77
+
78
+ keys . push ( value )
79
+ } , { scope : { index : i , ...scope } } )
72
80
73
81
scopes . push ( scope )
74
82
}
@@ -158,7 +166,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
158
166
let marker = document . createElement ( 'div' )
159
167
160
168
mutateDom ( ( ) => {
161
- if ( ! elForSpot ) warn ( `x-for ":key" is undefined or invalid` , templateEl )
169
+ if ( ! elForSpot ) warn ( `x-for ":key" is undefined or invalid` , templateEl , keyForSpot , lookup )
162
170
163
171
elForSpot . after ( marker )
164
172
elInSpot . after ( elForSpot )
0 commit comments