fix(orbit): skip bulk confirm when playTrack only navigates the existing queue

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Psychotoxical
2026-04-24 14:58:35 +02:00
parent 2d32ef7b2d
commit 3bbf628526
+15 -7
View File
@@ -1210,14 +1210,22 @@ export const usePlayerStore = create<PlayerState>()(
// ── playTrack ──────────────────────────────────────────────────────────── // ── playTrack ────────────────────────────────────────────────────────────
playTrack: (track, queue, manual = true, _orbitConfirmed = false) => { playTrack: (track, queue, manual = true, _orbitConfirmed = false) => {
// Orbit bulk-gate: a >1-track queue inside an active session is // Orbit bulk-gate: only gate when the `queue` argument *replaces*
// a "Play All / Play Album"-style action — confirm with the user // the current queue (Play All / Play Album / Play Playlist / Hero
// before it lands on every guest's player. // play buttons). Navigation calls — queue-row click, next(),
// previous() — pass the existing queue back through playTrack just
// to move the index; they are not bulk operations and must not
// trigger the confirm dialog (#234 regression).
if (!_orbitConfirmed && queue && queue.length > 1) { if (!_orbitConfirmed && queue && queue.length > 1) {
void orbitBulkGuard(queue.length).then(ok => { const current = get().queue;
if (ok) get().playTrack(track, queue, manual, true); const sameAsCurrent = queue.length === current.length
}); && queue.every((t, i) => current[i]?.id === t.id);
return; if (!sameAsCurrent) {
void orbitBulkGuard(queue.length).then(ok => {
if (ok) get().playTrack(track, queue, manual, true);
});
return;
}
} }
// Ghost-command guard: if a gapless switch happened within 500 ms, // Ghost-command guard: if a gapless switch happened within 500 ms,