From 7cba39dfaf19fe054b91a979b73c602bd87b3250 Mon Sep 17 00:00:00 2001 From: Honey Date: Sat, 27 Jun 2026 11:32:19 +0200 Subject: [PATCH] fix(web): NowPlaying showed a stale cover after rapid skips The NP overlay only refreshed its cover while open, so skipping with it closed left the on the last-opened song; reopening briefly showed that old cover until the current one loaded. Now the NP cover element is kept pointed at the current song even while closed (loads in the background), so opening it always shows the right artwork. Co-Authored-By: Claude Opus 4.8 --- src/player/player.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/player/player.js b/src/player/player.js index 04550ba..bff1412 100644 --- a/src/player/player.js +++ b/src/player/player.js @@ -527,9 +527,15 @@ export function updatePlayerUI(s, _skipMediaSession = false) { } catch {} _syncNpDirect(s); _updatePlayingHighlights(); - // Preload the hi-res NP cover now so opening the overlay is instant + // Keep the NP cover element pointing at the CURRENT song even while the overlay is closed, + // so opening it after rapid skips never shows a stale cover (it also preloads in the background). const _npCv = coverUrl(s.coverArt, 1024); - if (_npCv && _npCv !== _npBgLastUrl) { const _pre = new Image(); _pre.src = _npCv; } + const _npCover = document.getElementById('np-cover'); + const _npImg = _npCover?.querySelector('img'); + if (_npCv) { + if (_npImg) { if (_npImg.src !== _npCv) _npImg.src = _npCv; } + else if (_npCover) _npCover.innerHTML = ``; + } // Pre-warm the next song's 1024 cover so auto-advance NP swap is instant from cache const _nextForPreload = S.qIdx + 1 < S.queue.length ? S.queue[S.qIdx + 1] : null; if (_nextForPreload?.coverArt) {