wrap fullstack rebuilds in block in place
This commit is contained in:
1 parent
c0f2e8391c
commit
36ae7ec12e
1 file changed
+3
-2
@@ -10,6 +10,7 @@ use std::future::Future;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
use tokio::task::block_in_place;
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use dioxus_lib::prelude::*;
|
use dioxus_lib::prelude::*;
|
||||||
@@ -64,7 +65,7 @@ impl SsrRendererPool {
|
|||||||
let prev_context = SERVER_CONTEXT.with(|ctx| ctx.replace(server_context));
|
let prev_context = SERVER_CONTEXT.with(|ctx| ctx.replace(server_context));
|
||||||
// poll the future, which may call server_context()
|
// poll the future, which may call server_context()
|
||||||
tracing::info!("Rebuilding vdom");
|
tracing::info!("Rebuilding vdom");
|
||||||
vdom.rebuild(&mut NoOpMutations);
|
block_in_place(|| vdom.rebuild(&mut NoOpMutations));
|
||||||
vdom.wait_for_suspense().await;
|
vdom.wait_for_suspense().await;
|
||||||
tracing::info!("Suspense resolved");
|
tracing::info!("Suspense resolved");
|
||||||
// after polling the future, we need to restore the context
|
// after polling the future, we need to restore the context
|
||||||
@@ -124,7 +125,7 @@ impl SsrRendererPool {
|
|||||||
.with(|ctx| ctx.replace(Box::new(server_context)));
|
.with(|ctx| ctx.replace(Box::new(server_context)));
|
||||||
// poll the future, which may call server_context()
|
// poll the future, which may call server_context()
|
||||||
tracing::info!("Rebuilding vdom");
|
tracing::info!("Rebuilding vdom");
|
||||||
vdom.rebuild(&mut NoOpMutations);
|
block_in_place(|| vdom.rebuild(&mut NoOpMutations));
|
||||||
vdom.wait_for_suspense().await;
|
vdom.wait_for_suspense().await;
|
||||||
tracing::info!("Suspense resolved");
|
tracing::info!("Suspense resolved");
|
||||||
// after polling the future, we need to restore the context
|
// after polling the future, we need to restore the context
|
||||||
|
|||||||
Reference in new issue
Block a user