From 87b7ff1ae02d9335eb26ddff4dca8f5db7026901 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Fri, 18 Apr 2025 00:43:44 +0200 Subject: [PATCH] fix: race conditions --- src/lib/components/app/daemon.svelte | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/components/app/daemon.svelte b/src/lib/components/app/daemon.svelte index 9298766..7ed97e4 100644 --- a/src/lib/components/app/daemon.svelte +++ b/src/lib/components/app/daemon.svelte @@ -54,11 +54,9 @@ }); $effect(() => { - console.log('asdf') - // Run this effect whenever state.isPlaying or audioElement changes if (!audioElement) return; - if (state.isPlaying) { + if (state.isPlaying && state.hasInteracted) { audioElement.play().catch(() => { state.error = "Audio playback failed. Please interact with the page first."; state.isPlaying = false; @@ -75,7 +73,14 @@ {#if !state.hasInteracted}