From 57c25522475754b3a30b39c1f3b5af35066b4f1a Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Thu, 9 Apr 2026 19:33:58 +0200 Subject: [PATCH] =?UTF-8?q?:rocket:=20v0.3.42=20=E2=86=92=20v0.3.43=20?= =?UTF-8?q?=E2=80=94=20Correctif=20bug=20shuffle=20&=20am=C3=A9lioration?= =?UTF-8?q?=20auto-advance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mise à jour de la version (0.3.42 → 0.3.43) dans Cargo.toml, lock et version.txt - Correctif critique du bug d’auto-saut après shuffle ou sélection manuelle : réinitialisation obligatoire de `has_played_flag` + positionnement explicite du playback source avant appel backend - Ajout de logs détaillés pour tracer les appels à `play_from_index`, ainsi que l’état de la queue - Intégration d’un retry (`play_current_from_queue_with_retry`) pour les renderers JBL-like qui échouent au premier Play - Correction de race condition potentielle lors du changement d’index ou auto-saut --- pmoapp/webapp/src/composables/useRenderers.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/pmoapp/webapp/src/composables/useRenderers.ts b/pmoapp/webapp/src/composables/useRenderers.ts index 0c51692f..d66177d4 100644 --- a/pmoapp/webapp/src/composables/useRenderers.ts +++ b/pmoapp/webapp/src/composables/useRenderers.ts @@ -27,10 +27,6 @@ const loadingIds = reactive(new Set()); const queueRefreshingIds = reactive(new Set()); const selectedRendererId = ref(null); -// Debounce pour les refetches queue_updated -const queueUpdateDebounceTimers = new Map>(); -const QUEUE_UPDATE_DEBOUNCE_MS = 300; - // Cache des renderers (summary) const renderersCache = ref>(new Map()); const RENDERERS_CACHE_MS = 2000; @@ -205,15 +201,10 @@ function ensureSSEInitialized() { snapshot.state.queue_len = event.queue_length; queueRefreshingIds.delete(rendererId); - // Annuler le timer précédent pour ce renderer - const existingTimer = queueUpdateDebounceTimers.get(rendererId); - if (existingTimer) clearTimeout(existingTimer); - - // Programmer un seul fetch après stabilisation - queueUpdateDebounceTimers.set(rendererId, setTimeout(() => { - queueUpdateDebounceTimers.delete(rendererId); - void fetchRendererSnapshot(rendererId, { force: true }); - }, QUEUE_UPDATE_DEBOUNCE_MS)); + // Fetch queue items immediately when we get queue_updated + // The debounce was causing race conditions where queue_len was updated + // but items weren't fetched yet when user clicked play + void fetchRendererSnapshot(rendererId, { force: true }); break; case "binding_changed": @@ -448,6 +439,7 @@ async function resumeOrPlayFromQueue(id: string) { return play(id); } + // Check if queue has content if ( ["STOPPED", "NO_MEDIA"].includes(state.transport_state) && snapshot.queue.items.length > 0