fix(ivy): don't project removed placeholders with runtime i18n (#30783)

When translated content was projected, all of the content was reappended, even the placeholders that had been removed in the translation.
To avoid that we added a new flag on `TNode` that specifies that a node is detached, in which case it should be ignored by the projection.

FW-1319 #resolve
PR Close #30783
This commit is contained in:
Olivier Combe
2019-06-05 20:47:21 +02:00
committed by Misko Hevery
parent 05a43ca869
commit 30efb6b8ea
4 changed files with 23 additions and 17 deletions

View File

@ -784,15 +784,17 @@ export function appendProjectedNodes(
appendChild(nodeToProject, tProjectionNode, lView);
} else {
while (nodeToProject) {
if (nodeToProject.type === TNodeType.Projection) {
appendProjectedNodes(
lView, tProjectionNode, (nodeToProject as TProjectionNode).projection,
findComponentView(projectedView));
} else {
// This flag must be set now or we won't know that this node is projected
// if the nodes are inserted into a container later.
nodeToProject.flags |= TNodeFlags.isProjected;
appendProjectedNode(nodeToProject, tProjectionNode, lView, projectedView);
if (!(nodeToProject.flags & TNodeFlags.isDetached)) {
if (nodeToProject.type === TNodeType.Projection) {
appendProjectedNodes(
lView, tProjectionNode, (nodeToProject as TProjectionNode).projection,
findComponentView(projectedView));
} else {
// This flag must be set now or we won't know that this node is projected
// if the nodes are inserted into a container later.
nodeToProject.flags |= TNodeFlags.isProjected;
appendProjectedNode(nodeToProject, tProjectionNode, lView, projectedView);
}
}
nodeToProject = nodeToProject.projectionNext;
}