mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 15:44:42 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab69750c01 | ||
|
|
b90fe273d5 | ||
|
|
5f0fab9f63 |
@@ -2,6 +2,11 @@ use crate::ChildrenFn;
|
||||
use cfg_if::cfg_if;
|
||||
use leptos_dom::IntoView;
|
||||
use leptos_macro::component;
|
||||
#[cfg(all(
|
||||
target_arch = "wasm32",
|
||||
any(feature = "hydrate", feature = "csr")
|
||||
))]
|
||||
use leptos_reactive::untrack;
|
||||
|
||||
/// Renders components somewhere else in the DOM.
|
||||
///
|
||||
@@ -36,6 +41,7 @@ pub fn Portal(
|
||||
.unwrap_or_else(|| document().body().expect("body to exist").unchecked_into());
|
||||
|
||||
create_effect(move |_| {
|
||||
leptos::logging::log!("inside Portal effect");
|
||||
let tag = if is_svg { "g" } else { "div" };
|
||||
|
||||
let container = document()
|
||||
@@ -53,7 +59,8 @@ pub fn Portal(
|
||||
container.clone()
|
||||
};
|
||||
|
||||
let _ = render_root.append_child(&children().into_view().get_mountable_node());
|
||||
let children = untrack(|| children().into_view().get_mountable_node());
|
||||
let _ = render_root.append_child(&children);
|
||||
|
||||
let _ = mount.append_child(&container);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user