fix(ivy): support projecting into dynamic views (#24752)

PR Close #24752
This commit is contained in:
Kara Erickson
2018-07-03 10:03:48 -07:00
committed by Miško Hevery
parent 49df4ef454
commit dc1f1295ee
2 changed files with 171 additions and 7 deletions

View File

@ -1963,12 +1963,9 @@ export function projectionDef(
// execute selector matching logic if and only if:
// - there are selectors defined
// - a node has a tag name / attributes that can be matched
if (selectors) {
const matchedIdx = matchingSelectorIndex(componentChild.tNode, selectors, textSelectors !);
distributedNodes[matchedIdx].push(componentChild);
} else {
distributedNodes[0].push(componentChild);
}
const bucketIndex =
selectors ? matchingSelectorIndex(componentChild.tNode, selectors, textSelectors !) : 0;
distributedNodes[bucketIndex].push(componentChild);
componentChild = getNextLNode(componentChild);
}
@ -2031,8 +2028,10 @@ export function projection(
const currentParent = getParentLNode(node);
const canInsert = canInsertNativeNode(currentParent, viewData);
let grandparent: LContainerNode;
const renderParent = currentParent.tNode.type === TNodeType.View ?
(getParentLNode(currentParent) as LContainerNode).data[RENDER_PARENT] ! :
(grandparent = getParentLNode(currentParent) as LContainerNode) &&
grandparent.data[RENDER_PARENT] ! :
currentParent as LElementNode;
for (let i = 0; i < nodesForSelector.length; i++) {