chore: Snackbar duplicate key warnings (#2121)

* fix the duplicate key warning in woot snackbar

* review fixes

* remove console.log

Co-authored-by: Nithin David <webofnithin@gmail.com>
This commit is contained in:
Muhsin Keloth 2021-04-19 22:21:59 +05:30 committed by GitHub
parent 654893b6d7
commit 773557e49b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,14 +2,13 @@
<transition-group name="toast-fade" tag="div" class="ui-snackbar-container">
<woot-snackbar
v-for="snackMessage in snackMessages"
:key="snackMessage"
:message="snackMessage"
:key="snackMessage.key"
:message="snackMessage.message"
/>
</transition-group>
</template>
<script>
/* global bus */
import WootSnackbar from './Snackbar';
export default {
@ -31,7 +30,7 @@ export default {
mounted() {
bus.$on('newToastMessage', message => {
this.snackMessages.push(message);
this.snackMessages.push({ key: new Date().getTime(), message });
window.setTimeout(() => {
this.snackMessages.splice(0, 1);
}, this.duration);