fix(player): cap persisted queue window (#756)

Playing/shuffling a big playlist set `queue` to ~10k `Track` objects.
zustand `persist` then `JSON.stringify`'d the whole queue into `localStorage`
on every persisted `set` → `QuotaExceededError` storm: playback never started
and the main thread stalled on each write.

`partialize` now persists only a ±250-track window around `queueIndex`
(remapping the index into the slice) instead of the entire queue.

The authoritative full queue lives server-side — synced via Subsonic
`savePlayQueue` and restored through `getPlayQueue`. localStorage is only a
fast local cache, so bounding it doesn't lose the queue; it just restores a
±250 window instantly while the full queue rehydrates from the server.

Controlled before/after on a 10,509-track playlist:
- before: QuotaExceededError ×9, play/shuffle dead
- after: QuotaExceeded = 0, playback works
This commit is contained in:
‮Artem
2026-05-17 22:06:41 +03:00
committed by GitHub
parent ce10272f01
commit be9722149b
4 changed files with 117 additions and 18 deletions
+7
View File
@@ -205,6 +205,13 @@ const CONTRIBUTOR_ENTRIES = [
'Search: queue pasted share links from live search (PR #551)',
],
},
{
github: 'artplan1',
since: '1.46.0',
contributions: [
'Player: cap persisted queue to ±250-track window — fixes QuotaExceededError on large playlists (PR #756)',
],
},
{
github: 'Psychotoxical',
since: '1.0.0',