feat(ui): explicit server-unavailable state + auto-refetch on reconnect (MAPPS-351) #412
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/MAPPS-351-server-down-ux"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes the "everything vanishes when the server is down" UX (MAPPS-351), building on MAPPS-333 (reachability flag + non-blocking banner +
/readyrecovery poll).Why
Data-driven pages loaded with
use_resource(...).ok().unwrap_or_default(), which swallows a failed fetch into an empty default. During an outage a page rendered empty tables / zero counts that looked identical to a brand-new tenant with no data. The banner was the only signal; the content lied.How
New primitives
RemoteData<T>+use_remote_resource(src/hooks/remote_data.rs): preserve a failed fetch as an explicitUnavailablestate, and subscribe toSERVER_REACHABLEso resources auto-refetch the instant the server returns. The(outcome, reachable) -> RemoteDatamapping is the pure, unit-testedclassify_remote.ContentUnavailable(src/components/content_unavailable.rs): the honest page body swapped in when the primary resource isUnavailable. KeepsAppLayoutchrome (sidebar nav, top bar, MAPPS-333 banner stay visible) and offers "Go to dashboard". Mirrors thePermissionRequiredempty-state idiom.use_can_mutate(src/hooks/server_status.rs): disables writes while down so a click cannot silently fail.Retrofits
Deferred (option 3, scaffold only)
src/hooks/edit_queue.rslays downPendingEdit,EDIT_QUEUE,enqueue, and areplay_pending_editswhose backoff/conflict body is commented out, plus a commented reconnect call inuse_server_status_monitor. Compiles and is inert; hold-and-replay (the local-first slice) becomes a small, well-located change later. Today writes are blocked/discarded while down.Acceptance criteria
classify_remote, incl. the down -> reconnect sequence).Verification
just pre-commit(dockerized): fmt, clippy-D warnings, wasmcargo check,test --lib= 200 passed.Refs #MAPPS-351.