mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fix(orbit): bulk plays append instead of replacing the shared queue
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { useAuthStore } from './authStore';
|
||||
import { useOfflineStore } from './offlineStore';
|
||||
import { useHotCacheStore } from './hotCacheStore';
|
||||
import { orbitBulkGuard } from '../utils/orbitBulkGuard';
|
||||
import { useOrbitStore } from './orbitStore';
|
||||
|
||||
export interface Track {
|
||||
id: string;
|
||||
@@ -1222,7 +1223,17 @@ export const usePlayerStore = create<PlayerState>()(
|
||||
&& queue.every((t, i) => current[i]?.id === t.id);
|
||||
if (!sameAsCurrent) {
|
||||
void orbitBulkGuard(queue.length).then(ok => {
|
||||
if (ok) get().playTrack(track, queue, manual, true);
|
||||
if (!ok) return;
|
||||
// Inside an Orbit session a bulk replace would discard guest
|
||||
// suggestions mid-listen. Append instead — the dialog's
|
||||
// "Add them all" copy already matches that semantic. Outside
|
||||
// Orbit, proceed as a normal replace.
|
||||
const role = useOrbitStore.getState().role;
|
||||
if (role === 'host' || role === 'guest') {
|
||||
get().enqueue(queue, true);
|
||||
} else {
|
||||
get().playTrack(track, queue, manual, true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getAlbum } from '../api/subsonic';
|
||||
import { usePlayerStore } from '../store/playerStore';
|
||||
import { songToTrack } from '../store/playerStore';
|
||||
import { useOrbitStore } from '../store/orbitStore';
|
||||
|
||||
function fadeOut(setVolume: (v: number) => void, from: number, durationMs: number): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
@@ -28,6 +29,16 @@ export async function playAlbum(albumId: string): Promise<void> {
|
||||
});
|
||||
if (!tracks.length) return;
|
||||
|
||||
// In Orbit sessions, playAlbum is effectively an append operation (the
|
||||
// playerStore bulk-gate also routes replaces into enqueue). Skip the
|
||||
// fadeOut entirely — the current track keeps playing, the album goes
|
||||
// onto the end of the queue after the user confirms the bulk dialog.
|
||||
const orbitRole = useOrbitStore.getState().role;
|
||||
if (orbitRole === 'host' || orbitRole === 'guest') {
|
||||
usePlayerStore.getState().enqueue(tracks);
|
||||
return;
|
||||
}
|
||||
|
||||
const store = usePlayerStore.getState();
|
||||
const { isPlaying, volume } = store;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user