Skip to content

Commit

Permalink
use_future_with: simplify code a bit by using read-only use_memo rath…
Browse files Browse the repository at this point in the history
…er than use_state
  • Loading branch information
Ekleog committed Feb 21, 2024
1 parent d0419a2 commit 8deac09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/yew/src/suspense/hooks.rs
Expand Up @@ -94,7 +94,7 @@ where
let output = use_state(|| None);
// We only commit a result if it comes from the latest spawned future. Otherwise, this
// might trigger pointless updates or even override newer state.
let latest_id = use_state(|| Cell::new(0u32));
let latest_id = use_memo_base(|()| (Cell::new(0u32), ()), ());

let suspension = {
let output = output.clone();
Expand Down

0 comments on commit 8deac09

Please sign in to comment.