Skip to content

Commit

Permalink
Fixed: Program fails when no, or multiple rooms exist
Browse files Browse the repository at this point in the history
Allows getRoom() to return NULL if no room exists, and returns single room if multiple rooms exist with the same "roomId" without breaking the program.
  • Loading branch information
antman1p authored Jan 10, 2025
1 parent 68b5368 commit b8b8e9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/adapter-supabase/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export class SupabaseDatabaseAdapter extends DatabaseAdapter {
.from("rooms")
.select("id")
.eq("id", roomId)
.single();
.maybeSingle();

if (error) {
throw new Error(`Error getting room: ${error.message}`);
console.error(`Error getting room: ${error.message}`);
return null;
}

return data ? (data.id as UUID) : null;
}

Expand Down

0 comments on commit b8b8e9e

Please sign in to comment.