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);