mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 14:54:16 +00:00
This commit is contained in:
parent
7996f835d0
commit
9fd2987447
2 changed files with 28 additions and 4 deletions
|
@ -173,6 +173,9 @@ where
|
|||
runtime,
|
||||
);
|
||||
|
||||
#[cfg(feature = "experimental-islands")]
|
||||
let prev_no_hydrate =
|
||||
SharedContext::no_hydrate();
|
||||
#[cfg(feature = "experimental-islands")]
|
||||
{
|
||||
SharedContext::set_no_hydrate(
|
||||
|
@ -180,7 +183,7 @@ where
|
|||
);
|
||||
}
|
||||
|
||||
with_owner(owner, {
|
||||
let rendered = with_owner(owner, {
|
||||
move || {
|
||||
HydrationCtx::continue_from(
|
||||
current_id,
|
||||
|
@ -194,7 +197,15 @@ where
|
|||
.render_to_string()
|
||||
.to_string()
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
#[cfg(feature = "experimental-islands")]
|
||||
SharedContext::set_no_hydrate(
|
||||
prev_no_hydrate,
|
||||
);
|
||||
|
||||
#[allow(clippy::let_and_return)]
|
||||
rendered
|
||||
}
|
||||
},
|
||||
// in-order streaming
|
||||
|
@ -205,6 +216,9 @@ where
|
|||
runtime,
|
||||
);
|
||||
|
||||
#[cfg(feature = "experimental-islands")]
|
||||
let prev_no_hydrate =
|
||||
SharedContext::no_hydrate();
|
||||
#[cfg(feature = "experimental-islands")]
|
||||
{
|
||||
SharedContext::set_no_hydrate(
|
||||
|
@ -212,7 +226,7 @@ where
|
|||
);
|
||||
}
|
||||
|
||||
with_owner(owner, {
|
||||
let rendered = with_owner(owner, {
|
||||
move || {
|
||||
HydrationCtx::continue_from(
|
||||
current_id,
|
||||
|
@ -225,7 +239,15 @@ where
|
|||
.into_view()
|
||||
.into_stream_chunks()
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
#[cfg(feature = "experimental-islands")]
|
||||
SharedContext::set_no_hydrate(
|
||||
prev_no_hydrate,
|
||||
);
|
||||
|
||||
#[allow(clippy::let_and_return)]
|
||||
rendered
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
@ -339,11 +339,13 @@ thread_local! {
|
|||
impl SharedContext {
|
||||
/// Whether the renderer should currently add hydration IDs.
|
||||
pub fn no_hydrate() -> bool {
|
||||
println!("no_hydrate == {}", NO_HYDRATE.with(Cell::get));
|
||||
NO_HYDRATE.with(Cell::get)
|
||||
}
|
||||
|
||||
/// Sets whether the renderer should not add hydration IDs.
|
||||
pub fn set_no_hydrate(hydrate: bool) {
|
||||
println!("set_no_hydrate == {}", hydrate);
|
||||
NO_HYDRATE.with(|cell| cell.set(hydrate));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue