Skip to content

Commit

Permalink
wrap fullstack rebuilds in block in place
Browse files Browse the repository at this point in the history
  • Loading branch information
ealmloff committed Feb 19, 2024
1 parent c0f2e83 commit 36ae7ec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/fullstack/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 36ae7ec

Please sign in to comment.