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 = () => {