From ca5c34ac485c92b672f297bb3e74e32306a51206 Mon Sep 17 00:00:00 2001 From: Ryan Di Date: Mon, 2 Jun 2025 13:07:14 +1000 Subject: [PATCH] store all rooms --- excalidraw-app/data/roomManager.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/excalidraw-app/data/roomManager.ts b/excalidraw-app/data/roomManager.ts index 008cad901..d3b5afa88 100644 --- a/excalidraw-app/data/roomManager.ts +++ b/excalidraw-app/data/roomManager.ts @@ -142,10 +142,7 @@ class RoomManager { filteredRooms.unshift(newRoom); - // Limit to the most recent 20 rooms - const limitedRooms = filteredRooms.slice(0, 20); - - await this.saveRooms(limitedRooms); + await this.saveRooms(filteredRooms); } async getRooms(): Promise { @@ -179,6 +176,16 @@ class RoomManager { } } + async getCurrentRoom(): Promise { + const rooms = await this.loadRooms(); + if (rooms.length === 0) { + return null; + } + + // Return the most recently accessed room + return rooms.sort((a, b) => b.lastAccessed - a.lastAccessed)[0]; + } + async clearAllRooms(): Promise { try { localStorage.removeItem(ROOM_STORAGE_KEY);