Skip to content

Commit f7eb0c2

Browse files
committed
Fix top-level reconciliation in portals (#3020)
1 parent 1ebdacd commit f7eb0c2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

packages/yew/src/dom_bundle/bportal.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Reconcilable for VPortal {
8686
self,
8787
_root: &BSubtree,
8888
parent_scope: &AnyScope,
89-
parent: &Element,
89+
_parent: &Element,
9090
next_sibling: NodeRef,
9191
portal: &mut Self::Bundle,
9292
) -> NodeRef {
@@ -110,8 +110,8 @@ impl Reconcilable for VPortal {
110110
node.reconcile_node(
111111
&portal.inner_root,
112112
parent_scope,
113-
parent,
114-
next_sibling.clone(),
113+
&portal.host,
114+
portal.inner_sibling.clone(),
115115
&mut portal.node,
116116
);
117117
next_sibling
@@ -181,6 +181,21 @@ mod layout_tests {
181181
},
182182
expected: "<div><i></i><o>PORTAL</o>AFTER</div>",
183183
});
184+
layouts.push(TestLayout {
185+
name: "Portal - update inner content",
186+
node: html! {
187+
<div>
188+
{VNode::VRef(first_target.clone().into())}
189+
{VNode::VRef(second_target.clone().into())}
190+
{VNode::VPortal(VPortal::new(
191+
html! { <> {"PORTAL"} <b /> </> },
192+
second_target.clone(),
193+
))}
194+
{"AFTER"}
195+
</div>
196+
},
197+
expected: "<div><i></i><o>PORTAL<b></b></o>AFTER</div>",
198+
});
184199
layouts.push(TestLayout {
185200
name: "Portal - replaced by text",
186201
node: html! {

0 commit comments

Comments
 (0)