mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
parent
91e0fcdc1b
commit
2d418dae93
1 changed files with 21 additions and 7 deletions
|
@ -168,7 +168,7 @@ pub(crate) struct EachItem {
|
|||
#[cfg(all(target_arch = "wasm32", feature = "web"))]
|
||||
document_fragment: Option<web_sys::DocumentFragment>,
|
||||
#[cfg(debug_assertions)]
|
||||
opening: Comment,
|
||||
opening: Option<Comment>,
|
||||
pub(crate) child: View,
|
||||
closing: Option<Comment>,
|
||||
#[cfg(not(all(target_arch = "wasm32", feature = "web")))]
|
||||
|
@ -201,7 +201,11 @@ impl EachItem {
|
|||
None
|
||||
},
|
||||
#[cfg(debug_assertions)]
|
||||
Comment::new(Cow::Borrowed("<EachItem>"), &id, false),
|
||||
if needs_closing {
|
||||
Some(Comment::new(Cow::Borrowed("<EachItem>"), &id, false))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
);
|
||||
|
||||
#[cfg(all(target_arch = "wasm32", feature = "web"))]
|
||||
|
@ -215,7 +219,10 @@ impl EachItem {
|
|||
if !HydrationCtx::is_hydrating() {
|
||||
#[cfg(debug_assertions)]
|
||||
fragment
|
||||
.append_with_node_2(&markers.1.node, &closing.node)
|
||||
.append_with_node_2(
|
||||
&markers.1.as_ref().unwrap().node,
|
||||
&closing.node,
|
||||
)
|
||||
.unwrap();
|
||||
fragment.append_with_node_1(&closing.node).unwrap();
|
||||
}
|
||||
|
@ -260,10 +267,6 @@ impl Mountable for EachItem {
|
|||
|
||||
#[inline(always)]
|
||||
fn get_opening_node(&self) -> web_sys::Node {
|
||||
#[cfg(debug_assertions)]
|
||||
return self.opening.node.clone();
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
return self.child.get_opening_node();
|
||||
}
|
||||
|
||||
|
@ -673,10 +676,20 @@ fn apply_cmds<T, EF, N>(
|
|||
// 4. Add
|
||||
if cmds.clear {
|
||||
cmds.removed.clear();
|
||||
crate::log!("clearing list");
|
||||
web_sys::console::log_2(
|
||||
&wasm_bindgen::JsValue::from_str("open"),
|
||||
opening,
|
||||
);
|
||||
web_sys::console::log_2(
|
||||
&wasm_bindgen::JsValue::from_str("closing"),
|
||||
closing,
|
||||
);
|
||||
|
||||
if opening.previous_sibling().is_none()
|
||||
&& closing.next_sibling().is_none()
|
||||
{
|
||||
crate::log!("no siblings");
|
||||
let parent = closing
|
||||
.parent_node()
|
||||
.expect("could not get closing node")
|
||||
|
@ -689,6 +702,7 @@ fn apply_cmds<T, EF, N>(
|
|||
#[cfg(not(debug_assertions))]
|
||||
parent.append_with_node_1(closing).unwrap();
|
||||
} else {
|
||||
crate::log!("yes siblings");
|
||||
range.set_start_before(opening).unwrap();
|
||||
range.set_end_before(closing).unwrap();
|
||||
|
||||
|
|
Loading…
Reference in a new issue