Fixed #5225 - Toast: Race condition on remove

pull/5656/head
tugcekucukoglu 2024-04-24 12:23:32 +03:00
parent 3902a31d38
commit 8a79cdecff
1 changed files with 4 additions and 9 deletions

View File

@ -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) {