From 8b258b0d2602d66b17653fbb57a69664ed52ade5 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Fri, 22 Nov 2024 14:55:24 -0500 Subject: [PATCH] fix: notify Suspense on subsequent reloads (closes #3277) (#3278) --- .../async_derived/arc_async_derived.rs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/reactive_graph/src/computed/async_derived/arc_async_derived.rs b/reactive_graph/src/computed/async_derived/arc_async_derived.rs index 95a4b1c6c1..ecb747299e 100644 --- a/reactive_graph/src/computed/async_derived/arc_async_derived.rs +++ b/reactive_graph/src/computed/async_derived/arc_async_derived.rs @@ -117,6 +117,7 @@ pub struct ArcAsyncDerived { pub(crate) loading: Arc, } +#[allow(dead_code)] pub(crate) trait BlockingLock { fn blocking_read_arc(self: &Arc) -> async_lock::RwLockReadGuardArc; @@ -583,19 +584,17 @@ impl ReadUntracked for ArcAsyncDerived { fn try_read_untracked(&self) -> Option { if let Some(suspense_context) = use_context::() { - if self.value.blocking_read().is_none() { - let handle = suspense_context.task_id(); - let ready = SpecialNonReactiveFuture::new(self.ready()); - crate::spawn(async move { - ready.await; - drop(handle); - }); - self.inner - .write() - .or_poisoned() - .suspenses - .push(suspense_context); - } + let handle = suspense_context.task_id(); + let ready = SpecialNonReactiveFuture::new(self.ready()); + crate::spawn(async move { + ready.await; + drop(handle); + }); + self.inner + .write() + .or_poisoned() + .suspenses + .push(suspense_context); } AsyncPlain::try_new(&self.value).map(ReadGuard::new) }