fix(web): route component handler errors through warn_and_toast_with#480
Merged
intendednull merged 1 commit intoApr 28, 2026
Merged
Conversation
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
This was referenced Apr 28, 2026
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.
Summary
anyhow::Result<()>from client mutations withlet _ = h.foo(...).await, so failures vanished without a toast or warn-log.crates/web/src/components/{roles,settings,sync_queue_view,channel_sidebar}.rsto capturelet toasts = use_context::<ToastStack>()on the outer reactive frame and dispatch viacrate::handlers::warn_and_toast_with("<action>", &e, toasts.as_ref())onErr.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 -- --checkcargo clippy -p willow-web --all-targets -- -D warningscargo test -p willow-web(6 tests, all green)cargo check -p willow-web --target wasm32-unknown-unknowncargo 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