Fixed #5225 - Toast: Race condition on remove
parent
3902a31d38
commit
8a79cdecff
|
@ -72,17 +72,12 @@ export default {
|
||||||
this.messages = [...this.messages, message];
|
this.messages = [...this.messages, message];
|
||||||
},
|
},
|
||||||
remove(params) {
|
remove(params) {
|
||||||
let index = -1;
|
const index = this.messages.findIndex((m) => m.id === params.message.id);
|
||||||
|
|
||||||
for (let i = 0; i < this.messages.length; i++) {
|
|
||||||
if (this.messages[i] === params.message) {
|
|
||||||
index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
this.messages.splice(index, 1);
|
this.messages.splice(index, 1);
|
||||||
this.$emit(params.type, { message: params.message });
|
this.$emit(params.type, { message: params.message });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onAdd(message) {
|
onAdd(message) {
|
||||||
if (this.group == message.group) {
|
if (this.group == message.group) {
|
||||||
|
|
Loading…
Reference in New Issue