refactor: replace setTimeout with tick() for DOM scroll query

handleViewArtistDiscography now uses await tick() instead of
setTimeout(100ms) to wait for the DOM update before scrolling
to the discography section.
This commit is contained in:
vicrodh committed 2026-03-09 11:05:50 -06:00
1 parent 620dc10a3a
commit fd3586cf70
1 file changed
+7 -11
+7 -11
View File
@@ -860,19 +860,15 @@
/**
* Navigate to artist view and scroll to Discography section
*/
function handleViewArtistDiscography() {
async function handleViewArtistDiscography() {
if (selectedAlbum?.artistId) {
// Store scroll target for artist view
const artistId = selectedAlbum.artistId;
handleArtistClick(artistId).then(() => {
// Use setTimeout to allow the view to render before scrolling
setTimeout(() => {
const discographySection = document.querySelector('.artist-section');
if (discographySection) {
discographySection.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}, 100);
});
await handleArtistClick(artistId);
await tick();
const discographySection = document.querySelector('.artist-section');
if (discographySection) {
discographySection.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
}