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();
|
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>
|
||||||
|
|||||||
Reference in New Issue
Block a user