fix(settings): preserve server editor drafts until save succeeds
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# Settings server editor save/retry UX
|
||||
|
||||
## Finding and scoped fix
|
||||
|
||||
The editor popped its route with a validated draft before `connections.save`
|
||||
started. A rejected persistence write therefore lost the typed configuration.
|
||||
The section now supplies an optional awaited `onSave` callback; the route closes
|
||||
only on success. Errors appear inline (live-region semantics), preserving both
|
||||
fields. Native controls show `Saving server…`; fields, duplicate submissions and
|
||||
Back are blocked only while the save is pending. Normal Back/cancel and existing
|
||||
callers without the callback retain their route/result behavior.
|
||||
|
||||
New profile identity is stable through retries. This also prevents a duplicate
|
||||
profile if persistence succeeds but subsequent connection activation fails.
|
||||
Selection, server isolation, catalog persistence and connection APIs are unchanged.
|
||||
No shell, navigation foundation, theme, transport or device changes.
|
||||
|
||||
Actual source diff: `saved_server_editor.dart` adds awaited save/pending/error
|
||||
handling and stable draft identity; `saved_servers_section.dart` moves persistence
|
||||
inside that callback instead of saving after the editor has popped.
|
||||
|
||||
## Evidence and checks
|
||||
|
||||
- Four new regression cases (Material + Cupertino, failed edit/pending/retry and
|
||||
failed activation/add/retry) failed against the original source and pass now.
|
||||
Two additional cases verify Back cancels drafts without persistence/activation.
|
||||
- `flutter test test/features/settings test/core/servers
|
||||
test/application/server_selection_test.dart
|
||||
test/application/server_fallback_wiring_test.dart`: **88 passed**.
|
||||
- `flutter analyze`: **no issues**.
|
||||
- `flutter build web`: **passed**, including Wasm dry run.
|
||||
- Isolated browser fixture build and `node tool/server_editor_save_probe.mjs`:
|
||||
**12 checks passed** at 390×844 across Material and Cupertino hosts, including
|
||||
actual typing, pending/repeated click, failure draft retention and retry.
|
||||
Fixture uses only in-memory persistence, loopback static hosting, a fresh Chrome
|
||||
profile and OS-assigned ports; no server/socket/production requests.
|
||||
- Six PNG captures and `result.json` live in
|
||||
`app/build/server-editor-save-evidence/` in this worktree (ignored build output).
|
||||
Both failure/draft captures were visually inspected: fields, error and retry
|
||||
control are visible without overflow. Probe Chrome and loopback server exited.
|
||||
|
||||
## Limits
|
||||
|
||||
Browser fixture is not an end-to-end production storage test. Native Android/iOS,
|
||||
screen-reader speech and physical-device behavior are unverified. No deployment,
|
||||
APK build, installation, ADB, production data changes or shared-service restart.
|
||||
`PipelinesRoot._activate` replaces the native app during connection activation;
|
||||
draft retention across a failure after that root remount is not verified/fixed
|
||||
here. The activation-error retry test uses an injected callback without remount.
|
||||
Rejected persistence writes never invoke activation and do retain the editor.
|
||||
Reference in New Issue
Block a user