Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1e65dcd

Browse files
Arneirobintown
andauthored
Change ListNotificationState to store room ids (#9518)
* Changed ListNotificationState to store room ids ListNotificationState stores a reference to a rooms array which is later used for comparing the stored array with new arrays. However, the comparison may fail since the stored array can be changed outside the class. This PR proposes to instead store only the room ids, which hopefully allows to avoid the issue by copying the room ids into a new array, while still being performant. Signed-off-by: Arne Wilken [email protected] * Change ListNotificationState to shallow clone rooms Instead of using room ids like in the previous commit, shallow clone the rooms array instead. Signed-off-by: Arne Wilken [email protected] Co-authored-by: Robin <[email protected]>
1 parent 89a1eac commit 1e65dcd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/stores/notifications/ListNotificationState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class ListNotificationState extends NotificationState {
4545

4646
const oldRooms = this.rooms;
4747
const diff = arrayDiff(oldRooms, rooms);
48-
this.rooms = rooms;
48+
this.rooms = [...rooms];
4949
for (const oldRoom of diff.removed) {
5050
const state = this.states[oldRoom.roomId];
5151
if (!state) continue; // We likely just didn't have a badge (race condition)

0 commit comments

Comments
 (0)