mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 22:45:41 +00:00
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:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user