Improve performance of widget startup slightly
See https://github.com/matrix-org/matrix-react-sdk/pull/6733#pullrequestreview-745513275
This commit is contained in:
parent
36f4b9f723
commit
6590572124
1 changed files with 2 additions and 1 deletions
|
@ -301,7 +301,8 @@ export class StopGapWidget extends EventEmitter {
|
||||||
// requests timeline capabilities in other rooms down the road. It's just easier to manage here.
|
// requests timeline capabilities in other rooms down the road. It's just easier to manage here.
|
||||||
for (const room of MatrixClientPeg.get().getRooms()) {
|
for (const room of MatrixClientPeg.get().getRooms()) {
|
||||||
// Timelines are most recent last
|
// Timelines are most recent last
|
||||||
const roomEvent = arrayFastClone(room.getLiveTimeline()?.getEvents() || []).reverse()[0];
|
const events = room.getLiveTimeline()?.getEvents() || [];
|
||||||
|
const roomEvent = events[events.length - 1];
|
||||||
if (!roomEvent) continue; // force later code to think the room is fresh
|
if (!roomEvent) continue; // force later code to think the room is fresh
|
||||||
this.readUpToMap[room.roomId] = roomEvent.getId();
|
this.readUpToMap[room.roomId] = roomEvent.getId();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue