mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22:01:09 +02:00
fix(matrix): check _rooms array for last room restoration
Use _rooms.some() instead of getRoom() to check if the last selected room exists, as the client's internal room cache may not be populated yet at PREPARED state. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
aa13473b94
commit
5cd067ae6f
1 changed files with 6 additions and 2 deletions
|
|
@ -265,8 +265,12 @@ class MatrixStore {
|
|||
// Restore last selected room
|
||||
if (browser && !this._currentRoomId) {
|
||||
const lastRoomId = localStorage.getItem(LAST_ROOM_KEY);
|
||||
if (lastRoomId && this._client!.getRoom(lastRoomId)) {
|
||||
this.selectRoom(lastRoomId);
|
||||
if (lastRoomId) {
|
||||
// Check if room exists in loaded rooms
|
||||
const roomExists = this._rooms.some((r) => r.roomId === lastRoomId);
|
||||
if (roomExists) {
|
||||
this.selectRoom(lastRoomId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue