fix: album detail header re-renders with sort tags after songs load; search artist uses dispArtistById
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
25d80eb559
commit
eb47a42f15
1 file changed
+8
-1
+8
-1
@@ -665,6 +665,13 @@ export async function loadAlbumDetail(album) {
|
|||||||
const songs = r.album?.song || [];
|
const songs = r.album?.song || [];
|
||||||
const totalMin = Math.round(songs.reduce((s,t) => s+(t.duration||0), 0) / 60);
|
const totalMin = Math.round(songs.reduce((s,t) => s+(t.duration||0), 0) / 60);
|
||||||
document.getElementById('album-detail-stats').textContent = `${songs.length} Titel · ${r.album.year||''} · ${totalMin} Min.`;
|
document.getElementById('album-detail-stats').textContent = `${songs.length} Titel · ${r.album.year||''} · ${totalMin} Min.`;
|
||||||
|
// Re-render header after songs load — by now overrides cache is ready and songs carry sortAlbum/sortArtist
|
||||||
|
if (songs[0]) {
|
||||||
|
document.getElementById('album-detail-name').textContent = dispAlbum(songs[0]) || dispAlbumName(album.name);
|
||||||
|
artistEl.innerHTML = parseArtists(songs[0])
|
||||||
|
.map(a => `<span class="song-link" onclick="event.stopPropagation();s_goArtist(event,'${esc(a.originalName||a.name)}','${esc(a.id||'')}')">${esc(dispArtistById(a.id, a.name))}</span>`)
|
||||||
|
.join('<span style="color:var(--text3)"> • </span>') || '';
|
||||||
|
}
|
||||||
document.getElementById('btn-play-album').onclick = () => playQueue(songs, 0);
|
document.getElementById('btn-play-album').onclick = () => playQueue(songs, 0);
|
||||||
document.getElementById('btn-dl-album').onclick = () => {
|
document.getElementById('btn-dl-album').onclick = () => {
|
||||||
songs.forEach((s,i) => setTimeout(() => dlSongLocal(s), i*400));
|
songs.forEach((s,i) => setTimeout(() => dlSongLocal(s), i*400));
|
||||||
@@ -1005,7 +1012,7 @@ export async function doLocalSearch(q, el) {
|
|||||||
const s = mkSection('Künstler');
|
const s = mkSection('Künstler');
|
||||||
const g = document.createElement('div'); g.className = 'scroll-row';
|
const g = document.createElement('div'); g.className = 'scroll-row';
|
||||||
artists.forEach(a => {
|
artists.forEach(a => {
|
||||||
const c = makeCard(a.name, a.albumCount+' Alben', null, '🎤');
|
const c = makeCard(dispArtistById(a.id, a.name), a.albumCount+' Alben', null, '🎤');
|
||||||
c.classList.add('artist-card');
|
c.classList.add('artist-card');
|
||||||
c.onclick = () => navigate('artist-detail', a);
|
c.onclick = () => navigate('artist-detail', a);
|
||||||
g.appendChild(c);
|
g.appendChild(c);
|
||||||
|
|||||||
Reference in new issue
Block a user