feat(web/player): self-heal a stale system-playlist / radio queue on total failure
test-web / test (push) Successful in 39s
test-web / test (push) Successful in 39s
When the whole queue proves unplayable (e.g. a tab left open across the daily system-playlist rebuild — the exact stale-snapshot case), the player now re-pulls the fresh snapshot and resumes instead of dead-ending on "Try again". The seeder hands the store an opaque refetch closure so the store stays decoupled from the playlist API and the per-artist (songs_like_artist) identity problem: single-instance variants re-pull via systemShuffle, per-artist mixes via getPlaylist(id), radio re-seeds from its track. Bounded to one self-heal per exhaustion (reset on the next successful play) so a still-broken refresh can't loop; "Try again" stays the genuine last resort. Wired from PlaylistCard, the playlist detail page, and playRadio. Issue #968. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import { user } from '$lib/auth/store.svelte';
|
||||
import { getPlaylist, systemShuffle, refreshSystem } from '$lib/api/playlists';
|
||||
import { playlistTrackToRef } from '$lib/playlists/playlistTrackToRef';
|
||||
import { systemPlaylistRefetch } from '$lib/playlists/systemRefetch';
|
||||
import { errCode } from '$lib/api/errors';
|
||||
import { qk } from '$lib/api/queries';
|
||||
import { playQueue } from '$lib/player/store.svelte';
|
||||
@@ -80,7 +81,14 @@
|
||||
const detail = await systemShuffle(variant);
|
||||
const refs = toTrackRefs(detail.tracks);
|
||||
if (refs.length > 0) {
|
||||
playQueue(refs, 0, { source: variant });
|
||||
playQueue(refs, 0, {
|
||||
source: variant,
|
||||
refetch: systemPlaylistRefetch({
|
||||
variant,
|
||||
playlistId: playlist.id,
|
||||
perArtist: false,
|
||||
}),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const detail = await getPlaylist(playlist.id);
|
||||
@@ -93,7 +101,14 @@
|
||||
// so source attribution stays absent — the PlaylistCard
|
||||
// test pins this contract.
|
||||
if (variant != null) {
|
||||
playQueue(refs, 0, { source: variant });
|
||||
playQueue(refs, 0, {
|
||||
source: variant,
|
||||
refetch: systemPlaylistRefetch({
|
||||
variant,
|
||||
playlistId: playlist.id,
|
||||
perArtist: true,
|
||||
}),
|
||||
});
|
||||
} else {
|
||||
playQueue(refs, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user