diff --git a/src/lib/components/session/ParticipantView.svelte b/src/lib/components/session/ParticipantView.svelte index 6a7ae38..e08f9d0 100644 --- a/src/lib/components/session/ParticipantView.svelte +++ b/src/lib/components/session/ParticipantView.svelte @@ -45,6 +45,8 @@ let pInitFFmpeg: Promise | null = null; let selfUser: Promise | null = null; + let isCreatingGroup = $state(false); + onMount(() => { const groupsRef = collection(db, 'sessions', $page.params.id, 'groups'); const groupDocQuery = query(groupsRef, where('participants', 'array-contains', user.uid)); @@ -119,6 +121,9 @@ }); async function handleCreateGroup() { + if (isCreatingGroup) return; + isCreatingGroup = true; + try { const response = await fetch(`/api/session/${$page.params.id}/group`, { method: 'POST' @@ -135,6 +140,8 @@ } catch (error) { console.error('Error creating group:', error); notifications.error('Failed to create group'); + } finally { + isCreatingGroup = false; } } @@ -612,9 +619,9 @@ {:else} - {/if}