From 0751265105d735b445b1882a99c3b3bc7541f43d Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 31 Jul 2026 23:15:04 +0200 Subject: [PATCH] fix(web): editing a library entry warns before it wipes what the console cannot see MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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) --- web/messages/de.json | 1 + web/messages/en.json | 1 + web/src/sections/Library/GameForm.tsx | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/web/messages/de.json b/web/messages/de.json index dac9ead7..3687fd22 100644 --- a/web/messages/de.json +++ b/web/messages/de.json @@ -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", diff --git a/web/messages/en.json b/web/messages/en.json index 2bc48529..85d3f303 100644 --- a/web/messages/en.json +++ b/web/messages/en.json @@ -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", diff --git a/web/src/sections/Library/GameForm.tsx b/web/src/sections/Library/GameForm.tsx index 832a6f39..3ef460b5 100644 --- a/web/src/sections/Library/GameForm.tsx +++ b/web/src/sections/Library/GameForm.tsx @@ -343,6 +343,18 @@ export const GameForm: FC<{ help={m.library_field_tags_help()} /> + {/* 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" && ( +

+ {m.library_edit_overwrites()} +

+ )} {error && (