fix(webui): guard similar artist bubbles
- avoid calling buildArtistDetailPath when a similar artist has no usable id - render a disabled bubble instead so empty MusicBrainz IDs do not crash the panel
This commit is contained in:
parent
fa0ac4ced3
commit
54efb85240
1 changed files with 12 additions and 3 deletions
|
|
@ -3832,14 +3832,23 @@ function displaySimilarArtists(artists) {
|
|||
* Create a similar artist bubble card element
|
||||
*/
|
||||
function createSimilarArtistBubble(artist) {
|
||||
const artistId = artist.id ? String(artist.id).trim() : '';
|
||||
const hasArtistDetail = !!artistId;
|
||||
|
||||
// Create bubble container
|
||||
const bubble = document.createElement('a');
|
||||
const bubble = document.createElement(hasArtistDetail ? 'a' : 'div');
|
||||
bubble.className = 'similar-artist-bubble';
|
||||
bubble.href = buildArtistDetailPath(artist.id, artist.source || null);
|
||||
if (hasArtistDetail) {
|
||||
bubble.href = buildArtistDetailPath(artistId, artist.source || null);
|
||||
} else {
|
||||
bubble.setAttribute('aria-disabled', 'true');
|
||||
bubble.style.cursor = 'default';
|
||||
bubble.style.pointerEvents = 'none';
|
||||
}
|
||||
bubble.style.color = 'inherit';
|
||||
bubble.style.textDecoration = 'none';
|
||||
bubble.setAttribute('aria-label', artist.name);
|
||||
bubble.setAttribute('data-artist-id', artist.id);
|
||||
bubble.setAttribute('data-artist-id', artistId);
|
||||
bubble.setAttribute('data-artist-source', artist.source || '');
|
||||
if (artist.plugin) {
|
||||
bubble.setAttribute('data-artist-plugin', artist.plugin);
|
||||
|
|
|
|||
Loading…
Reference in a new issue