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:
@@ -27,8 +27,11 @@ Built in three slices:
|
|||||||
aggregates artists similar to the ones you follow into a manual review feed of
|
aggregates artists similar to the ones you follow into a manual review feed of
|
||||||
suggested **artists** and **albums** at `/discover`; **Follow** and **Want**
|
suggested **artists** and **albums** at `/discover`; **Follow** and **Want**
|
||||||
reuse the slice-2 follow / wanted flows, **Dismiss** is permanent. Plus a
|
reuse the slice-2 follow / wanted flows, **Dismiss** is permanent. Plus a
|
||||||
web-side seed-search box. No Spotify (its recommendation APIs are dead for new
|
web-side seed-search box. Every suggestion and seed-search result opens a
|
||||||
apps).
|
read-only **artist preview** (`/discover/artist/[mbid]`) — discography,
|
||||||
|
per-album tracklists, and "in library" / "monitored" badges — where you can
|
||||||
|
Follow or Want before committing. No Spotify (its recommendation APIs are dead
|
||||||
|
for new apps).
|
||||||
|
|
||||||
**Operational notes:** the monitor and the discovery sweep are both **off by
|
**Operational notes:** the monitor and the discovery sweep are both **off by
|
||||||
default** — set `monitor.enabled=true` (+ optional `monitor.*` tuning) in the
|
default** — set `monitor.enabled=true` (+ optional `monitor.*` tuning) in the
|
||||||
|
|||||||
@@ -836,3 +836,5 @@ Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>"
|
|||||||
- Tracklists are fetched live per expand; a short-lived cache (or persisting on Want) is a later option if MB rate-limiting bites.
|
- Tracklists are fetched live per expand; a short-lived cache (or persisting on Want) is a later option if MB rate-limiting bites.
|
||||||
- The preview shows one representative release's tracklist; multi-disc/edition differences aren't surfaced.
|
- The preview shows one representative release's tracklist; multi-disc/edition differences aren't surfaced.
|
||||||
- `have` via `LibraryItem` matches on `(artistName, album)` (name-based, like the existing wanted-add path); MBID-based library matching is a broader future change.
|
- `have` via `LibraryItem` matches on `(artistName, album)` (name-based, like the existing wanted-add path); MBID-based library matching is a broader future change.
|
||||||
|
- **TODO — reuse the preview page from the normal `/artists` live search.** The artists search→follow picker (`artists-client.tsx`) currently only follows; wire each MB search hit to also link to `/discover/artist/[mbid]?name=…` so you can preview (disco + tracklists + own-state) before following there too. The preview page + endpoints already exist — this is a small link-wiring task in `artists-client.tsx`.
|
||||||
|
- **Applied post-merge:** `want()` in `preview-client.tsx` now guards on `res.ok` before optimistically flipping the Monitored badge (was deferred item #1 from the whole-branch review).
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export function PreviewClient({ mbid, initialName }: { mbid: string; initialName
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function want(r: Release) {
|
async function want(r: Release) {
|
||||||
await fetch("/api/discover/want", {
|
const res = await fetch("/api/discover/want", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "application/json" },
|
headers: { "content-type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@@ -78,6 +78,7 @@ export function PreviewClient({ mbid, initialName }: { mbid: string; initialName
|
|||||||
firstReleaseDate: r.firstReleaseDate,
|
firstReleaseDate: r.firstReleaseDate,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
if (!res.ok) return; // don't flip the badge if the want failed
|
||||||
setData((d) =>
|
setData((d) =>
|
||||||
d ? { ...d, releases: d.releases.map((x) => (x.rgMbid === r.rgMbid ? { ...x, monitored: true } : x)) } : d,
|
d ? { ...d, releases: d.releases.map((x) => (x.rgMbid === r.rgMbid ? { ...x, monitored: true } : x)) } : d,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user