Compare commits

...

1 Commits

Author SHA1 Message Date
Greg Johnston 8278cbbf4e fix: don't re-mount identical child in `DynChild` 2023-06-19 09:14:45 -04:00
1 changed files with 9 additions and 5 deletions

View File

@ -273,7 +273,8 @@ where
// I can imagine some edge case that the child changes while // I can imagine some edge case that the child changes while
// hydration is ongoing // hydration is ongoing
if !HydrationCtx::is_hydrating() { if !HydrationCtx::is_hydrating() {
if !was_child_moved && child != new_child { let same_child = child == new_child;
if !was_child_moved && !same_child {
// Remove the child // Remove the child
let start = child.get_opening_node(); let start = child.get_opening_node();
let end = &closing; let end = &closing;
@ -308,10 +309,13 @@ where
} }
// Mount the new child // Mount the new child
mount_child( // If it's the same child, don't re-mount
MountKind::Before(&closing), if !same_child {
&new_child, mount_child(
); MountKind::Before(&closing),
&new_child,
);
}
} }
// We want to reuse text nodes, so hold onto it if // We want to reuse text nodes, so hold onto it if