refactor(ivy): rewrite refreshDynamicEmbeddedViews for clarity (#31839)
PR Close #31839
This commit is contained in:
parent
a77d0e22bf
commit
e08391b333
|
@ -1491,19 +1491,20 @@ export function createLContainer(
|
||||||
* by executing an associated template function.
|
* by executing an associated template function.
|
||||||
*/
|
*/
|
||||||
function refreshDynamicEmbeddedViews(lView: LView) {
|
function refreshDynamicEmbeddedViews(lView: LView) {
|
||||||
for (let current = lView[CHILD_HEAD]; current !== null; current = current[NEXT]) {
|
let viewOrContainer = lView[CHILD_HEAD];
|
||||||
// Note: current can be an LView or an LContainer instance, but here we are only interested
|
while (viewOrContainer !== null) {
|
||||||
// in LContainer. We can tell it's an LContainer because its length is less than the LView
|
// Note: viewOrContainer can be an LView or an LContainer instance, but here we are only
|
||||||
// header.
|
// interested in LContainer
|
||||||
if (current[ACTIVE_INDEX] === -1 && isLContainer(current)) {
|
if (isLContainer(viewOrContainer) && viewOrContainer[ACTIVE_INDEX] === -1) {
|
||||||
for (let i = CONTAINER_HEADER_OFFSET; i < current.length; i++) {
|
for (let i = CONTAINER_HEADER_OFFSET; i < viewOrContainer.length; i++) {
|
||||||
const dynamicViewData = current[i];
|
const embeddedLView = viewOrContainer[i];
|
||||||
// The directives and pipes are not needed here as an existing view is only being
|
// The directives and pipes are not needed here as an existing view is only being
|
||||||
// refreshed.
|
// refreshed.
|
||||||
ngDevMode && assertDefined(dynamicViewData[TVIEW], 'TView must be allocated');
|
ngDevMode && assertDefined(embeddedLView[TVIEW], 'TView must be allocated');
|
||||||
renderEmbeddedTemplate(dynamicViewData, dynamicViewData[TVIEW], dynamicViewData[CONTEXT] !);
|
renderEmbeddedTemplate(embeddedLView, embeddedLView[TVIEW], embeddedLView[CONTEXT] !);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewOrContainer = viewOrContainer[NEXT];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue