mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +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 { useOfflineStore } from './offlineStore';
|
||||||
import { useHotCacheStore } from './hotCacheStore';
|
import { useHotCacheStore } from './hotCacheStore';
|
||||||
import { orbitBulkGuard } from '../utils/orbitBulkGuard';
|
import { orbitBulkGuard } from '../utils/orbitBulkGuard';
|
||||||
|
import { useOrbitStore } from './orbitStore';
|
||||||
|
|
||||||
export interface Track {
|
export interface Track {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -1222,7 +1223,17 @@ export const usePlayerStore = create<PlayerState>()(
|
|||||||
&& queue.every((t, i) => current[i]?.id === t.id);
|
&& queue.every((t, i) => current[i]?.id === t.id);
|
||||||
if (!sameAsCurrent) {
|
if (!sameAsCurrent) {
|
||||||
void orbitBulkGuard(queue.length).then(ok => {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { getAlbum } from '../api/subsonic';
|
import { getAlbum } from '../api/subsonic';
|
||||||
import { usePlayerStore } from '../store/playerStore';
|
import { usePlayerStore } from '../store/playerStore';
|
||||||
import { songToTrack } 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> {
|
function fadeOut(setVolume: (v: number) => void, from: number, durationMs: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
@@ -28,6 +29,16 @@ export async function playAlbum(albumId: string): Promise<void> {
|
|||||||
});
|
});
|
||||||
if (!tracks.length) return;
|
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 store = usePlayerStore.getState();
|
||||||
const { isPlaying, volume } = store;
|
const { isPlaying, volume } = store;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user