mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
debug(matrix): add logging for room restoration
This commit is contained in:
parent
5cd067ae6f
commit
8768d6276c
1 changed files with 12 additions and 0 deletions
|
|
@ -265,13 +265,22 @@ class MatrixStore {
|
|||
// Restore last selected room
|
||||
if (browser && !this._currentRoomId) {
|
||||
const lastRoomId = localStorage.getItem(LAST_ROOM_KEY);
|
||||
console.log(
|
||||
`[Matrix] Restore check: lastRoomId=${lastRoomId}, rooms=${this._rooms.length}`
|
||||
);
|
||||
if (lastRoomId) {
|
||||
// Check if room exists in loaded rooms
|
||||
const roomExists = this._rooms.some((r) => r.roomId === lastRoomId);
|
||||
console.log(`[Matrix] Room exists: ${roomExists}`);
|
||||
if (roomExists) {
|
||||
console.log(`[Matrix] Restoring room: ${lastRoomId}`);
|
||||
this.selectRoom(lastRoomId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(
|
||||
`[Matrix] Skip restore: browser=${browser}, currentRoomId=${this._currentRoomId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -473,6 +482,7 @@ class MatrixStore {
|
|||
* Select a room to view
|
||||
*/
|
||||
selectRoom(roomId: string) {
|
||||
console.log(`[Matrix] selectRoom called: ${roomId}`);
|
||||
this._currentRoomId = roomId;
|
||||
const room = this._client?.getRoom(roomId);
|
||||
|
||||
|
|
@ -488,8 +498,10 @@ class MatrixStore {
|
|||
// Save last room to localStorage
|
||||
if (browser) {
|
||||
localStorage.setItem(LAST_ROOM_KEY, roomId);
|
||||
console.log(`[Matrix] Saved to localStorage: ${roomId}`);
|
||||
}
|
||||
} else {
|
||||
console.log(`[Matrix] Room not found by getRoom: ${roomId}`);
|
||||
this._timeline = [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue