diff --git a/packages/core/src/render3/i18n.ts b/packages/core/src/render3/i18n.ts index cff91d2278..7455ab11df 100644 --- a/packages/core/src/render3/i18n.ts +++ b/packages/core/src/render3/i18n.ts @@ -782,7 +782,10 @@ function readUpdateOpCodes( function removeNode(index: number, viewData: LView) { const removedPhTNode = getTNode(index, viewData); const removedPhRNode = getNativeByIndex(index, viewData); - removeChild(removedPhTNode, removedPhRNode || null, viewData); + if (removedPhRNode) { + removeChild(removedPhTNode, removedPhRNode, viewData); + } + removedPhTNode.detached = true; ngDevMode && ngDevMode.rendererRemoveNode++; @@ -790,7 +793,7 @@ function removeNode(index: number, viewData: LView) { if (isLContainer(slotValue)) { const lContainer = slotValue as LContainer; if (removedPhTNode.type !== TNodeType.Container) { - removeChild(removedPhTNode, lContainer[NATIVE] || null, viewData); + removeChild(removedPhTNode, lContainer[NATIVE], viewData); } lContainer[RENDER_PARENT] = null; } diff --git a/packages/core/src/render3/node_manipulation.ts b/packages/core/src/render3/node_manipulation.ts index 3d39d92bb9..d07248768e 100644 --- a/packages/core/src/render3/node_manipulation.ts +++ b/packages/core/src/render3/node_manipulation.ts @@ -631,9 +631,8 @@ export function nativeNextSibling(renderer: Renderer3, node: RNode): RNode|null * @param currentView The current LView * @returns Whether or not the child was appended */ -export function appendChild( - childEl: RNode | null = null, childTNode: TNode, currentView: LView): boolean { - if (childEl !== null && canInsertNativeNode(childTNode, currentView)) { +export function appendChild(childEl: RNode, childTNode: TNode, currentView: LView): boolean { + if (canInsertNativeNode(childTNode, currentView)) { const renderer = currentView[RENDERER]; const renderParent = getRenderParent(childTNode, currentView) !; const parentTNode: TNode = childTNode.parent || currentView[HOST_NODE] !; @@ -690,9 +689,9 @@ export function getBeforeNodeForView(index: number, views: LView[], containerNat * @param currentView The current LView * @returns Whether or not the child was removed */ -export function removeChild(childTNode: TNode, childEl: RNode | null, currentView: LView): boolean { +export function removeChild(childTNode: TNode, childEl: RNode, currentView: LView): boolean { // We only remove the element if not in View or not projected. - if (childEl !== null && canInsertNativeNode(childTNode, currentView)) { + if (canInsertNativeNode(childTNode, currentView)) { const parentNative = getRenderParent(childTNode, currentView) !; nativeRemoveChild(currentView[RENDERER], parentNative, childEl); return true;