fix: artists search marks already-followed artists instead of a Follow button
This commit is contained in:
@@ -64,6 +64,8 @@ export function ArtistsClient() {
|
||||
refresh();
|
||||
}
|
||||
|
||||
const followedMbids = new Set(artists.map((a) => a.mbid));
|
||||
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={search}>
|
||||
@@ -77,7 +79,11 @@ export function ArtistsClient() {
|
||||
<li key={h.mbid}>
|
||||
{h.name}
|
||||
{h.disambiguation ? ` (${h.disambiguation})` : ""}{" "}
|
||||
<button onClick={() => follow(h)}>Follow</button>
|
||||
{followedMbids.has(h.mbid) ? (
|
||||
<span> · following</span>
|
||||
) : (
|
||||
<button onClick={() => follow(h)}>Follow</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user