Open maxleaver opened 6 years ago
hey @maxleaver , can you please let me know what did you change to fix this error?
I simply updated the key used in calendar.html to utilize the index from v-for instead of the week number. The v-for loop that is the problem is on line 12 of calendar.html.
Original:
<tr class="calendar__week" v-for="week in calendar.days" @click="select" :key="'week--' + week">
Updated:
<tr class="calendar__week" v-for="(week, index) in calendar.days" @click="select" :key="'week--' + index">
The following error appears in console when using the calendar or running unit tests:
'[Vue warn]: Duplicate keys detected: 'week--[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]'. This may cause an update error.
Vue requires a unique key when iterating. The key for each week row is being passed the week object rather than the week number or an index. Updating the key on line 12 of calendar.html resolves the issue. Happy to submit a PR for this.