mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-18 15:00:39 +02:00
store all rooms
This commit is contained in:
@@ -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<CollabRoom[]> {
|
||||
@@ -179,6 +176,16 @@ class RoomManager {
|
||||
}
|
||||
}
|
||||
|
||||
async getCurrentRoom(): Promise<CollabRoom | null> {
|
||||
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<void> {
|
||||
try {
|
||||
localStorage.removeItem(ROOM_STORAGE_KEY);
|
||||
|
Reference in New Issue
Block a user