From 29b0dca1d8f7e7cbd59ef7c67bc2ea6a2f9642ec Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Sun, 28 Jul 2024 09:11:04 -0400 Subject: [PATCH] fix: allow Suspense to remount before rebuilding (closes #2721) --- tachys/src/reactive_graph/suspense.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tachys/src/reactive_graph/suspense.rs b/tachys/src/reactive_graph/suspense.rs index d13326d2c..9b8c95a71 100644 --- a/tachys/src/reactive_graph/suspense.rs +++ b/tachys/src/reactive_graph/suspense.rs @@ -151,6 +151,10 @@ where async move { let value = fut.await; drop(id); + // waiting a tick here allows Suspense to remount if necessary, which prevents some + // edge cases in which a rebuild can't happen while unmounted because the DOM node + // has no parent + any_spawner::Executor::tick().await; Some(value).rebuild(&mut *state.borrow_mut()); } });