From 4e771ff91ce6dda77342c949dfd2ff68227a7911 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Fri, 22 Nov 2024 14:00:46 -0500 Subject: [PATCH] fix: notify Suspense on subsequent reloads (closes #3277) --- .../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) }