From e97a2ed86f68eadff30c5d98402a0517177008f5 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Wed, 28 Jan 2026 13:10:11 -0600 Subject: [PATCH] fix(library): load artists before navigating from album view When clicking artist link from album view, ensure artists are loaded before switching to artists tab. This fixes empty page on first visit. --- .../components/views/LocalLibraryView.svelte | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lib/components/views/LocalLibraryView.svelte b/src/lib/components/views/LocalLibraryView.svelte index b4e3f496d..9930b5af1 100644 --- a/src/lib/components/views/LocalLibraryView.svelte +++ b/src/lib/components/views/LocalLibraryView.svelte @@ -2212,7 +2212,7 @@ return (exactMatch ?? results.items[0]).id; } - function handleLocalArtistClick(name?: string) { + async function handleLocalArtistClick(name?: string) { if (!name) return; if (normalizeArtistName(name) === 'various artists') return; @@ -2225,20 +2225,24 @@ // Switch to artists tab activeTab = 'artists'; + // Load artists if not already loaded + if (artists.length === 0) { + await loadArtists(); + } + // Select artist to show their albums in the right column selectedArtistName = name; // Scroll to the artist card after DOM updates // Use multiple ticks + small delay to ensure content is fully rendered - tick().then(() => { - setTimeout(() => { - const artistId = `local-artist-${normalizeArtistName(name)}`; - const artistCard = document.getElementById(artistId); - if (artistCard) { - artistCard.scrollIntoView({ behavior: 'smooth', block: 'center' }); - } - }, 100); - }); + await tick(); + setTimeout(() => { + const artistId = `local-artist-${normalizeArtistName(name)}`; + const artistCard = document.getElementById(artistId); + if (artistCard) { + artistCard.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } + }, 150); } /**