add-checked feedback returns: parse the Response before reading counts
Eric's report: no toast, no list update — yet the add landed. apiPost returns the raw Response (every other caller only truth-checks it); reading .added off it gave undefined and .skipped.length then THREW, killing the toast, the panel close, and the refresh in an unhandled rejection. The handler now parses the body first. Verified live: toast fires with the count, panel closes, the catalog updates in place (probe row removed from the data afterward). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016jXZFSTZQKzAC8fqpWSz9g
This commit is contained in:
co-authored by
Claude Fable 5
parent
06902538fe
commit
fb9f654cd8
+138
-137
File diff suppressed because one or more lines are too long
@@ -28,5 +28,15 @@
|
||||
"language_hint": "",
|
||||
"art_notes": "",
|
||||
"source_photos": []
|
||||
},
|
||||
{
|
||||
"title_raw": "The Red Dragon Inn 5: The Character Trove",
|
||||
"confidence": "high",
|
||||
"publisher_hint": "",
|
||||
"edition_hint": "",
|
||||
"year_hint": 2015,
|
||||
"language_hint": "",
|
||||
"art_notes": "",
|
||||
"source_photos": []
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1779,5 +1779,16 @@
|
||||
"art_notes": "",
|
||||
"source_photos": [],
|
||||
"title_normalized": "castle panic wizard s tower"
|
||||
},
|
||||
{
|
||||
"title_raw": "The Red Dragon Inn 5: The Character Trove",
|
||||
"confidence": "high",
|
||||
"publisher_hint": "",
|
||||
"edition_hint": "",
|
||||
"year_hint": 2015,
|
||||
"language_hint": "",
|
||||
"art_notes": "",
|
||||
"source_photos": [],
|
||||
"title_normalized": "red dragon inn 5 character trove"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -333,8 +333,10 @@ document.getElementById("addpicks").addEventListener("click", async () => {
|
||||
picks, stored_in: document.getElementById("pickcontainer").value,
|
||||
});
|
||||
if (res) {
|
||||
showToast(`added <b>${res.added}</b> game(s)` +
|
||||
(res.skipped.length ? ` — ${res.skipped.length} skipped (already on file)` : ""));
|
||||
// apiPost returns the raw Response; the counts live in its body
|
||||
const data = await res.json().catch(() => ({added: picks.length, skipped: []}));
|
||||
showToast(`added <b>${data.added}</b> game(s)` +
|
||||
(data.skipped.length ? ` — ${data.skipped.length} skipped (already on file)` : ""));
|
||||
pickPanel.hidden = true;
|
||||
document.getElementById("pickresults").innerHTML = "";
|
||||
document.getElementById("pickfooter").hidden = true;
|
||||
|
||||
Reference in New Issue
Block a user