wrap fullstack rebuilds in block in place

This commit is contained in:
Evan Almloff committed 2024-02-19 14:59:58 -06:00
1 parent c0f2e8391c
commit 36ae7ec12e
1 file changed
+3 -2
+3 -2
View File
@@ -10,6 +10,7 @@ use std::future::Future;
use std::sync::Arc;
use std::sync::RwLock;
use tokio::task::JoinHandle;
use tokio::task::block_in_place;
use crate::prelude::*;
use dioxus_lib::prelude::*;
@@ -64,7 +65,7 @@ impl SsrRendererPool {
let prev_context = SERVER_CONTEXT.with(|ctx| ctx.replace(server_context));
// poll the future, which may call server_context()
tracing::info!("Rebuilding vdom");
vdom.rebuild(&mut NoOpMutations);
block_in_place(|| vdom.rebuild(&mut NoOpMutations));
vdom.wait_for_suspense().await;
tracing::info!("Suspense resolved");
// after polling the future, we need to restore the context
@@ -124,7 +125,7 @@ impl SsrRendererPool {
.with(|ctx| ctx.replace(Box::new(server_context)));
// poll the future, which may call server_context()
tracing::info!("Rebuilding vdom");
vdom.rebuild(&mut NoOpMutations);
block_in_place(|| vdom.rebuild(&mut NoOpMutations));
vdom.wait_for_suspense().await;
tracing::info!("Suspense resolved");
// after polling the future, we need to restore the context