fix(playback): pin queue playback to source server when browsing another library (#717)

* fix(playback): pin queue streams, cover art, and library links to queue server

When the active server changes while a queue from another server is playing,
keep streams and UI on queueServerId; switch back for artist/album links and
queue or player-bar context menus.

* fix(playback): switch to queue server when opening Now Playing

Ensure active server matches queueServerId before Subsonic fetches on the
Now Playing page, mobile player route, and queue info panel; scope caches
by server id.

* docs(credits): mention Now Playing in PR #717 contribution line

* fix(playback): route scrobble and queue sync to queue server

Address PR review: apiForServer for scrobble/now-playing/savePlayQueue,
clear queueServerId on server removal, mini-player queueServerId sync,
block cross-server enqueue with toast, and regression tests.
This commit is contained in:
cucadmuh
2026-05-15 16:08:41 +03:00
committed by GitHub
parent a9b50b9244
commit 45e0e1206f
58 changed files with 701 additions and 178 deletions
+15
View File
@@ -12,7 +12,9 @@
*/
import { beforeEach, describe, expect, it } from 'vitest';
import { useAuthStore } from './authStore';
import { usePlayerStore } from './playerStore';
import { resetAuthStore } from '@/test/helpers/storeReset';
import { resetPlayerStore } from '@/test/helpers/storeReset';
import { makeServer } from '@/test/helpers/factories';
function addThree(): { a: string; b: string; c: string } {
@@ -24,6 +26,7 @@ function addThree(): { a: string; b: string; c: string } {
beforeEach(() => {
resetAuthStore();
resetPlayerStore();
});
describe('addServer / updateServer', () => {
@@ -122,6 +125,18 @@ describe('removeServer', () => {
useAuthStore.getState().removeServer(a);
expect(useAuthStore.getState().activeServerId).toBe(b);
});
it('clears queueServerId when the removed server owned the playback queue', () => {
const { a, b } = addThree();
useAuthStore.getState().setActiveServer(b);
usePlayerStore.setState({
queue: [{ id: 't1', title: 'T', artist: 'A', album: 'Al', albumId: 'al1', duration: 100 }],
queueServerId: a,
queueIndex: 0,
});
useAuthStore.getState().removeServer(a);
expect(usePlayerStore.getState().queueServerId).toBeNull();
});
});
describe('selectors — getBaseUrl / getActiveServer', () => {