fix(settings): restore radio groups by name on autosave rollback - #184
Merged
Merged
Conversation
Grouped radios (e.g. au-mode) lack element ids, so rollbackField's snap[el.id] lookup unchecked the clicked radio on a failed save instead of restoring the previously-selected one. Restore the whole group by name from the snapshot value (valuesById keys radio groups by name).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Autosave-Rollback stellt Radio-Gruppen per name wieder her
Beim Audit aller Autosave-Felder gefunden (Fehlerpfad-only, kein stiller Save-Verlust):
rollbackField()im Autosave-Controller stellte bei einem fehlgeschlagenen Save diskrete Controls aus dem Snapshot wieder her viael.checked = !!snap[el.id]. Gruppierte Radios (z. B.au-mode) haben kein Element-id, dahersnap[''] === undefined→ das gerade geklickte Radio wurde entwählt statt das vorher gewählte wiederherzustellen → Gruppe zeigte nichts ausgewählt.valuesByIdkeyt Radio-Gruppen per Gruppen-name ({ 'au-mode': selectedValue }). Fix: die ganze Gruppe perdocument.getElementsByName(el.name)auf den Snapshot-Wert zurücksetzen (das passende Radio.checkedsetzen entwählt die Geschwister automatisch). Checkbox-Zweig (mit IDs) sauber abgetrennt; Toggle/Select unverändert.Nur Fehlerpfad (
rollbackFieldläuft nur bei Confirm-Abbruch oder fehlgeschlagenem Save) — der Erfolgspfad ist unberührt. Smoke-Assertion ergänzt (Controller nutztgetElementsByName+snap[el.name]). Tests grün (autosave core+smoke+secret 22/22). DOM-Verhalten = dokumentierter No-jsdom-Blindfleck, wird live spot-gecheckt.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jrun6RoK7g75W5L8ZEpBzh