fix(web): busy gate + toast on mark-read#411
Merged
Merged
Conversation
mark_read_click swallow per-peer errors. No busy guard. Add `mark_busy` RwSignal, disable+aria-busy button while in flight, collect Err count, push error toast via ToastStack. Browser test pin busy contract. Closes #345
6 tasks
intendednull
added a commit
that referenced
this pull request
Apr 27, 2026
Handler closures in `crates/web/src/handlers.rs` swallowed every async error with `let _ = h.<action>(...).await`. Send/edit/delete/react/ pin/unpin failures vanished — typed message disappeared from input, no log, no toast. Refs #350 [GEN-07]. New `warn_and_toast_with(action, e, toasts)` helper: - `tracing::warn!(error = ?e, action, "ui handler failed")` - Pushes `Toast::err("Couldn't {action}. Try again.")` with a per- action `dedup` key so back-to-back failures coalesce instead of stacking. Mirrors the lazy `use_context::<ToastStack>()` pattern PR #411 introduced for the inbound mark-read button. Each handler now captures the toast stack on the synchronous frame (reactive owner intact) before `spawn_local`, then forwards into the helper from the async path — `wasm_bindgen_futures::spawn_local` strips the owner, so context lookup must happen earlier. 7 sites patched: send_message, send_reply, edit_message, delete_ message, react, pin_message, unpin_message. switch_channel / switch_server stay as-is — they return `()` so there was nothing to swallow. Browser test `handler_error_toasts::*` covers helper happy-path, dedup coalescing, and missing-stack no-panic. Test exercises the exact production code path; the handler closures themselves are pinned to ClientHandle<IrohNetwork> with no trait seam to inject a failing double, so going one level deeper would buy nothing. `rg "let _ = h\." crates/web/src/handlers.rs` returns empty. fmt + clippy + native tests + wasm check all green; browser tier verified locally via `cargo check -p willow-web --tests` + manual review of the test mod (Firefox/wasm-pack not on this box, browser suite runs in CI). Co-authored-by: Claude <noreply@anthropic.com>
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.
Why
mark_read_clickswallow per-peer errors withlet _ =. No busy gate → spammable. No toast → silent fail on flaky link.Fix
mark_busyRwSignal<bool>separate frombusy(retry path).mark_queue_readcalls.ToastStack(lazy lookup so headless tests withoutprovide_notifier()still drive the handler).disabled+aria-busy+ label flip tomarking…while in flight (mirror existingACTION_RETRY_BUSYpattern).Test
crates/web/tests/browser.rs— newsync_queue_view_mark_as_read_button_has_busy_attrspins aria-busy contract + idle label + early-return reset.toast_mark_read_failed_pluralisesinsync_queue_copy::tests.Verify
cargo check -p willow-web --target wasm32-unknown-unknowncleancargo clippy -p willow-web --all-targets -- -D warningscleanjust checkdeferred to CI (this branch built off the same base as chore: drop stale dead_code allows + dead helper #398/fix(web): type-safe peer_color blocks css inject #399/test(agent): cover bearer token const-time compare #400 which all green-CIed)Closes #345
Generated by Claude Code