From e447fd93f77574b6724711e0e418156cee0041e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Gaspard?= Date: Wed, 21 Feb 2024 23:55:50 +0100 Subject: [PATCH] use_future_with: simplify code a bit by using read-only use_memo rather than use_state --- packages/yew/src/suspense/hooks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yew/src/suspense/hooks.rs b/packages/yew/src/suspense/hooks.rs index b31a57663d6..033a4957cbd 100644 --- a/packages/yew/src/suspense/hooks.rs +++ b/packages/yew/src/suspense/hooks.rs @@ -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();