mirror of https://github.com/vector-im/riot-web
Step 8.4.3: Improve PlaybackQueue listener efficiency
parent
d89fcf17fb
commit
56b099c171
|
@ -51,15 +51,15 @@ export class PlaybackQueue {
|
||||||
constructor(private room: Room) {
|
constructor(private room: Room) {
|
||||||
this.loadClocks();
|
this.loadClocks();
|
||||||
|
|
||||||
RoomViewStore.instance.addListener(() => {
|
RoomViewStore.instance.addRoomListener(this.room.roomId, (isActive) => {
|
||||||
if (RoomViewStore.instance.getRoomId() === this.room.roomId) {
|
if (!isActive) return;
|
||||||
// Reset the state of the playbacks before they start mounting and enqueuing updates.
|
|
||||||
// We reset the entirety of the queue, including order, to ensure the user isn't left
|
// Reset the state of the playbacks before they start mounting and enqueuing updates.
|
||||||
// confused with what order the messages are playing in.
|
// We reset the entirety of the queue, including order, to ensure the user isn't left
|
||||||
this.currentPlaybackId = null; // this in particular stops autoplay when the room is switched to
|
// confused with what order the messages are playing in.
|
||||||
this.recentFullPlays = new Set<string>();
|
this.currentPlaybackId = null; // this in particular stops autoplay when the room is switched to
|
||||||
this.playbackIdOrder = [];
|
this.recentFullPlays = new Set<string>();
|
||||||
}
|
this.playbackIdOrder = [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue