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 (#3610)

* use_future_with: simplify code a bit by using read-only use_memo rather than use_state

* use use_ref instead of use_memo_base

---------

Co-authored-by: Elina <imelina@elina.website>
  • Loading branch information
Ekleog and ranile authored Aug 3, 2024
1 parent c5d4861 commit 4faa150
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/yew/src/suspense/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +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_ref(|| Cell::new(0u32));
let suspension = {
let output = output.clone();

Expand Down

0 comments on commit 4faa150

Please sign in to comment.