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:
Antti Kettunen 2026-05-19 19:51:54 +03:00
parent fa0ac4ced3
commit 54efb85240
No known key found for this signature in database
GPG key ID: C6B2A3D250359BD7

View file

@ -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);