fix(web): editing a library entry warns before it wipes what the console cannot see
`PUT /library/custom/{id}` replaces the whole entry — the host assigns
`slot.prep = input.prep` and `slot.detect = input.detect` outright
(library/custom.rs). But `GET /library` returns a `GameEntry`, which carries
neither field, so the console builds its payload from a read model that has
already lost them. Editing a title to fix a typo silently cleared any prep/undo
commands and detection hints the entry had.
The console cannot round-trip what the read API will not tell it, so this is a
warning, not a fix: the edit form now says plainly that saving replaces the entry
and that anything configured outside the console will be cleared. The actual fix
is host-side — expose `detect` and `prep` on the library read model — and is
noted in the code where it belongs.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -229,6 +229,7 @@
|
||||
"library_store_steam": "Steam",
|
||||
"library_store_custom": "Eigene",
|
||||
"library_add_title": "Eigenes Spiel hinzufügen",
|
||||
"library_edit_overwrites": "Beim Speichern wird dieser Eintrag durch das ersetzt, was in diesem Formular steht. Vorbereitungs-/Undo-Befehle und Erkennungs-Hinweise, die außerhalb der Konsole gesetzt wurden, erscheinen hier nicht und gehen verloren.",
|
||||
"library_edit_title": "Eigenes Spiel bearbeiten",
|
||||
"library_add_button": "Eigenes Spiel hinzufügen",
|
||||
"library_field_title": "Titel",
|
||||
|
||||
@@ -229,6 +229,7 @@
|
||||
"library_store_steam": "Steam",
|
||||
"library_store_custom": "Custom",
|
||||
"library_add_title": "Add a custom game",
|
||||
"library_edit_overwrites": "Saving replaces this entry with what's in this form. Prep/undo commands and detection hints set outside the console aren't shown here and will be cleared.",
|
||||
"library_edit_title": "Edit custom game",
|
||||
"library_add_button": "Add custom game",
|
||||
"library_field_title": "Title",
|
||||
|
||||
@@ -343,6 +343,18 @@ export const GameForm: FC<{
|
||||
help={m.library_field_tags_help()}
|
||||
/>
|
||||
</fieldset>
|
||||
{/* Data-loss warning, not a nicety.
|
||||
`PUT /library/custom/{id}` REPLACES the entry (host: library/custom.rs
|
||||
`update_custom` assigns `slot.prep = input.prep; slot.detect = input.detect`),
|
||||
but `GET /library` returns a `GameEntry`, which carries neither field. So the
|
||||
console cannot round-trip them — anything configured outside this form is dropped
|
||||
by a save it did not intend to touch. The real fix is host-side (expose `detect`
|
||||
and `prep` on the read model); until then, say so before the operator finds out. */}
|
||||
{mode === "edit" && (
|
||||
<p className="rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm">
|
||||
{m.library_edit_overwrites()}
|
||||
</p>
|
||||
)}
|
||||
{error && (
|
||||
<p
|
||||
role="alert"
|
||||
|
||||
Reference in New Issue
Block a user