fix(server-switch): keep cached playback alive + Settings tab-id typo (#262)

* fix(server-switch): keep cached playback alive across servers

Drop the clearQueue() + initializeFromServerQueue() calls that were added
alongside the header server switcher (c75297fc). clearQueue() fires
audio_stop, killing the currently-playing (cached) track the moment the
user clicks a different server. Restore the pre-c75297fc behaviour: just
swap activeServerId, let the Rust audio engine keep streaming the
already-resolved URL, and let the next user action or the app-boot hook
pick up the new server's saved queue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(settings): use renamed 'servers' tab id in paste-invite handler

Leftover from #261 landing on top of #259 — the Settings tab was renamed
from 'server' to 'servers' in #259, but the openAddServerInvite route-state
handler still used the old literal. Caused a TS error and meant pasting a
psysonic1- invite did not actually switch tabs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Psychotoxical <dev@psysonic.app>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Frank Stellmacher
2026-04-22 13:32:59 +02:00
committed by GitHub
parent 7c9a300022
commit e89ae18780
2 changed files with 2 additions and 9 deletions
+2 -2
View File
@@ -1441,10 +1441,10 @@ export default function Settings() {
if (inv) { if (inv) {
setPastedServerInvite(inv); setPastedServerInvite(inv);
setShowAddForm(true); setShowAddForm(true);
setActiveTab('server'); setActiveTab('servers');
navigate( navigate(
{ pathname: location.pathname, search: location.search, hash: location.hash }, { pathname: location.pathname, search: location.search, hash: location.hash },
{ replace: true, state: { tab: 'server' as Tab } }, { replace: true, state: { tab: 'servers' as Tab } },
); );
return; return;
} }
-7
View File
@@ -1,12 +1,7 @@
import { pingWithCredentials, scheduleInstantMixProbeForServer } from '../api/subsonic'; import { pingWithCredentials, scheduleInstantMixProbeForServer } from '../api/subsonic';
import type { ServerProfile } from '../store/authStore'; import type { ServerProfile } from '../store/authStore';
import { useAuthStore } from '../store/authStore'; import { useAuthStore } from '../store/authStore';
import { usePlayerStore } from '../store/playerStore';
/**
* Ping, update server identity / Instant Mix probe, set active server, clear local playback
* and pull the new server's saved play queue.
*/
export async function switchActiveServer(server: ServerProfile): Promise<boolean> { export async function switchActiveServer(server: ServerProfile): Promise<boolean> {
try { try {
const ping = await pingWithCredentials(server.url, server.username, server.password); const ping = await pingWithCredentials(server.url, server.username, server.password);
@@ -21,8 +16,6 @@ export async function switchActiveServer(server: ServerProfile): Promise<boolean
scheduleInstantMixProbeForServer(server.id, server.url, server.username, server.password, identity); scheduleInstantMixProbeForServer(server.id, server.url, server.username, server.password, identity);
auth.setActiveServer(server.id); auth.setActiveServer(server.id);
auth.setLoggedIn(true); auth.setLoggedIn(true);
usePlayerStore.getState().clearQueue();
await usePlayerStore.getState().initializeFromServerQueue();
return true; return true;
} catch { } catch {
return false; return false;