Skip to content

fix(web): route component handler errors through warn_and_toast_with#480

Merged
intendednull merged 1 commit into
claude/friendly-maxwell-bVlpWfrom
auto-fix/issue-476-component-toasts
Apr 28, 2026
Merged

fix(web): route component handler errors through warn_and_toast_with#480
intendednull merged 1 commit into
claude/friendly-maxwell-bVlpWfrom
auto-fix/issue-476-component-toasts

Conversation

@intendednull
Copy link
Copy Markdown
Owner

Summary

  • Closes the propagation gap from PR fix(web): toast + log on handler failures #443 (which closed [GEN-07] All UI action handlers swallow errors with no toast / log #350): 11 component-internal handlers still discarded anyhow::Result<()> from client mutations with let _ = h.foo(...).await, so failures vanished without a toast or warn-log.
  • Migrates all 11 sites in crates/web/src/components/{roles,settings,sync_queue_view,channel_sidebar}.rs to capture let toasts = use_context::<ToastStack>() on the outer reactive frame and dispatch via crate::handlers::warn_and_toast_with("<action>", &e, toasts.as_ref()) on Err.
  • Action labels match handlers.rs precedent: create role, set permission, assign role, delete role, set server display name, mute server, retry queue, create voice channel, create channel, delete channel, mute channel.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p willow-web --all-targets -- -D warnings
  • cargo test -p willow-web (6 tests, all green)
  • cargo check -p willow-web --target wasm32-unknown-unknown
  • cargo check --target wasm32-unknown-unknown -p willow-web --tests (wasm-pack/Firefox not available in sandbox)
  • rg -n 'let _ = h\.[a-z_]+\(.*\)\.await' crates/web/src/components/ → 0 hits (was 11)

Refs #476


Generated by Claude Code

PR #443 closed #350 by routing client-mutation errors in handlers.rs
through warn_and_toast / warn_and_toast_with so the user sees a toast
instead of the action silently vanishing. The pattern was not
propagated to component-internal handlers — 11 sites across roles.rs,
settings.rs, sync_queue_view.rs, and channel_sidebar.rs still
discarded the anyhow::Result with `let _ = h.foo(...).await`.

Migrate all 11 sites:

- roles.rs: create role, set permission, assign role, delete role
- settings.rs: set server display name, mute server
- sync_queue_view.rs: retry queue
- channel_sidebar.rs: create channel, create voice channel,
  delete channel, mute channel

Each site now captures `let toasts = use_context::<ToastStack>()` on
the outer reactive frame (before `wasm_bindgen_futures::spawn_local`,
which strips the reactive owner), moves it into the async block, and
dispatches `crate::handlers::warn_and_toast_with("<action>", &e,
toasts.as_ref())` on Err.

`rg -n 'let _ = h\.[a-z_]+\(.*\)\.await' crates/web/src/components/`
goes from 11 hits to 0.

Refs #476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants