Skip to content

Commit

Permalink
fix top-level reconciliation in portals
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldSEnder committed Dec 6, 2022
1 parent 77b0d40 commit 88386fb
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions packages/yew/src/dom_bundle/bportal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Reconcilable for VPortal {
self,
_root: &BSubtree,
parent_scope: &AnyScope,
parent: &Element,
_parent: &Element,
next_sibling: NodeRef,
portal: &mut Self::Bundle,
) -> NodeRef {
Expand All @@ -110,8 +110,8 @@ impl Reconcilable for VPortal {
node.reconcile_node(
&portal.inner_root,
parent_scope,
parent,
next_sibling.clone(),
&portal.host,
portal.inner_sibling.clone(),
&mut portal.node,
);
next_sibling
Expand Down Expand Up @@ -181,6 +181,21 @@ mod layout_tests {
},
expected: "<div><i></i><o>PORTAL</o>AFTER</div>",
});
layouts.push(TestLayout {
name: "Portal - update inner content",
node: html! {
<div>
{VNode::VRef(first_target.clone().into())}
{VNode::VRef(second_target.clone().into())}
{VNode::VPortal(VPortal::new(
html! { <> {"PORTAL"} <b /> </> },
second_target.clone(),
))}
{"AFTER"}
</div>
},
expected: "<div><i></i><o>PORTAL<b></b></o>AFTER</div>",
});
layouts.push(TestLayout {
name: "Portal - replaced by text",
node: html! {
Expand Down

0 comments on commit 88386fb

Please sign in to comment.