From 88386fbd3151e9eb8a6afb1b3ea475d32c3e77f0 Mon Sep 17 00:00:00 2001 From: WorldSEnder Date: Tue, 6 Dec 2022 08:10:32 +0100 Subject: [PATCH] fix top-level reconciliation in portals --- packages/yew/src/dom_bundle/bportal.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/yew/src/dom_bundle/bportal.rs b/packages/yew/src/dom_bundle/bportal.rs index cc98cca8ef9..2fa79453f85 100644 --- a/packages/yew/src/dom_bundle/bportal.rs +++ b/packages/yew/src/dom_bundle/bportal.rs @@ -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 { @@ -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 @@ -181,6 +181,21 @@ mod layout_tests { }, expected: "
PORTALAFTER
", }); + layouts.push(TestLayout { + name: "Portal - update inner content", + node: html! { +
+ {VNode::VRef(first_target.clone().into())} + {VNode::VRef(second_target.clone().into())} + {VNode::VPortal(VPortal::new( + html! { <> {"PORTAL"} }, + second_target.clone(), + ))} + {"AFTER"} +
+ }, + expected: "
PORTALAFTER
", + }); layouts.push(TestLayout { name: "Portal - replaced by text", node: html! {