diff --git a/src/store/playerStore.ts b/src/store/playerStore.ts index 5401280c..cdd5c99a 100644 --- a/src/store/playerStore.ts +++ b/src/store/playerStore.ts @@ -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()( && 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; } diff --git a/src/utils/playAlbum.ts b/src/utils/playAlbum.ts index 3e47b600..3e6b7e65 100644 --- a/src/utils/playAlbum.ts +++ b/src/utils/playAlbum.ts @@ -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 { return new Promise(resolve => { @@ -28,6 +29,16 @@ export async function playAlbum(albumId: string): Promise { }); 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;