From cc141ae91a4bed71dd5162a091510d2e3741fd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Tue, 28 Jul 2026 14:56:40 +0000 Subject: [PATCH] web music: closing the dock clears the saved now-playing (so it stays closed) The dock's X only reset local player state; the server's now-playing snapshot survived, so a reload restored the dock. Closing now also DELETEs /music/now-playing before clearing the queue. Co-Authored-By: Claude Opus 4.8 --- .../officerdev/src/MusicPlayer/MusicPlayerHost.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/workspaces/officerdev/src/MusicPlayer/MusicPlayerHost.tsx b/src/workspaces/officerdev/src/MusicPlayer/MusicPlayerHost.tsx index ec99306f..0dd75db9 100644 --- a/src/workspaces/officerdev/src/MusicPlayer/MusicPlayerHost.tsx +++ b/src/workspaces/officerdev/src/MusicPlayer/MusicPlayerHost.tsx @@ -30,7 +30,7 @@ const fmt = (s: number): string => Number.isFinite(s) && s >= 0 ? `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, '0')}` : '0:00'; export const MusicPlayerHost = () => { - const { token, get, put } = useClient(); + const { token, get, put, delete: del } = useClient(); const navigate = useNavigate(); const [, setCwd] = usePanelChannel(MUSIC_CWD_CHANNEL, null); const { current, index, queue, playing, toggle, next, prev, setPlaying, syncIndex, close, loadQueue } = @@ -233,6 +233,13 @@ export const MusicPlayerHost = () => { const subtitle = current?.artist ?? current?.albumRel.split('/').slice(-2, -1)[0] ?? ''; const pct = duration ? (position / duration) * 100 : 0; + // Closing the dock also clears the saved "currently playing" snapshot, so it doesn't get restored on + // the next load. (Merely close()-ing the local queue would leave the server snapshot to bring it back.) + const handleClose = () => { + del('/music/now-playing').catch(() => {}); + close(); + }; + // Clicking the track info jumps the /music library to the playing album (and navigates there). const openCurrentAlbum = () => { if (!current) return; @@ -347,7 +354,7 @@ export const MusicPlayerHost = () => {