fix: artists search marks already-followed artists instead of a Follow button

This commit is contained in:
Jonathan
2026-07-11 17:50:53 +02:00
parent aafd8b15d5
commit 28fc1ee1a8
+6
View File
@@ -64,6 +64,8 @@ export function ArtistsClient() {
refresh(); refresh();
} }
const followedMbids = new Set(artists.map((a) => a.mbid));
return ( return (
<div> <div>
<form onSubmit={search}> <form onSubmit={search}>
@@ -77,7 +79,11 @@ export function ArtistsClient() {
<li key={h.mbid}> <li key={h.mbid}>
{h.name} {h.name}
{h.disambiguation ? ` (${h.disambiguation})` : ""}{" "} {h.disambiguation ? ` (${h.disambiguation})` : ""}{" "}
{followedMbids.has(h.mbid) ? (
<span> · following</span>
) : (
<button onClick={() => follow(h)}>Follow</button> <button onClick={() => follow(h)}>Follow</button>
)}
</li> </li>
))} ))}
</ul> </ul>