From bf0bc45c4b691df84624aec5b8904418d960105d Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 8 Oct 2026 17:33:10 -0400 Subject: [PATCH] fix(web): filter a refetched mix inside the self-heal step, not by wrapping the closure (#5418) The wrapper added a promise hop, so the self-heal test's single microtask wait saw 'loading' instead of 'error'. Co-Authored-By: Claude Opus 5.5 --- web/src/lib/player/store.svelte.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/lib/player/store.svelte.ts b/web/src/lib/player/store.svelte.ts index 01e12442..bce1c43a 100644 --- a/web/src/lib/player/store.svelte.ts +++ b/web/src/lib/player/store.svelte.ts @@ -144,8 +144,7 @@ export function playQueue( // rotation-aware order, so no client shuffle in that path). _queueSource = opts.source ?? null; // #968: a fresh play replaces the self-heal closure + resets its budget. - const refetch = opts.refetch; - _queueRefetch = refetch ? () => refetch().then(playable) : null; + _queueRefetch = opts.refetch ?? null; _selfHealAttempts = 0; // Start on the chosen track's place in the playable list; if the chosen // one is missing, that place holds the next playable track after it. @@ -376,7 +375,8 @@ function trySelfHeal(): boolean { _error = null; const refetch = _queueRefetch; void refetch() - .then((refs) => { + .then((fetched) => { + const refs = playable(fetched); if (refs.length > 0) { // Re-seed in place — keep _queueSource / _queueRefetch so the new // snapshot can itself self-heal, and don't reset _selfHealAttempts