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.
This commit is contained in:
1 parent
2ad92a5854
commit
e97a2ed86f
1 file changed
+14
-10
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user