Skip to content

Commit 5040000

Browse files
authored
fix: remove child from previous parent if needed due to animations (#93)
1 parent 17b90a5 commit 5040000

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/angular/src/lib/view-util.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ export class ViewUtil {
8080
const extendedParent = this.ensureNgViewExtensions(parent);
8181
const extendedChild = this.ensureNgViewExtensions(child);
8282

83+
// this should never enter, as angular is supposed to remove the child from the previous parent before calling this
84+
// but when angular animations are enabled, the removal might be delayed, so we need to ensure this view is not anywhere
85+
// this seems to only happens to CommentNodes
86+
if (extendedChild.parentNode) {
87+
this.removeChild(extendedChild.parentNode, extendedChild);
88+
}
8389
// if there's a next child, previous is the previousSibling of it
8490
if (next) {
8591
previous = next.previousSibling;

0 commit comments

Comments
 (0)