mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-23 15:31:22 +02:00
Fix crash when filtering new room list too fast
Fixes https://github.com/vector-im/riot-web/issues/14092 We were simply assuming we had a reference to a notification state, which might not be the case if we're between renders.
This commit is contained in:
parent
69c5aecfc7
commit
7191c01265
@ -240,6 +240,7 @@ export class ListNotificationState extends EventEmitter implements IDestroyable
|
|||||||
this.rooms = rooms;
|
this.rooms = rooms;
|
||||||
for (const oldRoom of diff.removed) {
|
for (const oldRoom of diff.removed) {
|
||||||
const state = this.states[oldRoom.roomId];
|
const state = this.states[oldRoom.roomId];
|
||||||
|
if (!state) continue; // We likely just didn't have a badge (race condition)
|
||||||
delete this.states[oldRoom.roomId];
|
delete this.states[oldRoom.roomId];
|
||||||
state.off(NOTIFICATION_STATE_UPDATE, this.onRoomNotificationStateUpdate);
|
state.off(NOTIFICATION_STATE_UPDATE, this.onRoomNotificationStateUpdate);
|
||||||
state.destroy();
|
state.destroy();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user