fix(preview): guard want() on res.ok; docs: preview in README + artists-search TODO
- preview-client want() no longer flips the Monitored badge when the POST fails (deferred item #1 from the discovery-preview whole-branch review). - README: discovery section notes the artist preview page. - Plan Notes + project-state: TODO to reuse the preview page from the /artists live search (wire artists-client.tsx hits to /discover/artist/[mbid]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -65,7 +65,7 @@ export function PreviewClient({ mbid, initialName }: { mbid: string; initialName
|
||||
}
|
||||
|
||||
async function want(r: Release) {
|
||||
await fetch("/api/discover/want", {
|
||||
const res = await fetch("/api/discover/want", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
@@ -78,6 +78,7 @@ export function PreviewClient({ mbid, initialName }: { mbid: string; initialName
|
||||
firstReleaseDate: r.firstReleaseDate,
|
||||
}),
|
||||
});
|
||||
if (!res.ok) return; // don't flip the badge if the want failed
|
||||
setData((d) =>
|
||||
d ? { ...d, releases: d.releases.map((x) => (x.rgMbid === r.rgMbid ? { ...x, monitored: true } : x)) } : d,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user