fix(ivy): don't detect changes on detached child embedded views (#34846)
Fixes Ivy detecting changes inside child embedded views, even though they're detached. Note that there's on subtlety here: I made the changes inside `refreshDynamicEmbeddedViews` rather than `refreshView`, because we support detecting changes on a detached view (evidenced by a couple of unit tests), but only if it's triggered directly from the view's `ChangeDetectorRef`, however we shouldn't be detecting changes in the detached child view when something happens in the parent. Fixes #34816. PR Close #34846
This commit is contained in:

committed by
Andrew Kushnir

parent
65354fb4ac
commit
62e1186140
@ -1525,7 +1525,10 @@ function refreshDynamicEmbeddedViews(lView: LView) {
|
||||
const embeddedLView = viewOrContainer[i];
|
||||
const embeddedTView = embeddedLView[TVIEW];
|
||||
ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
|
||||
refreshView(embeddedLView, embeddedTView, embeddedTView.template, embeddedLView[CONTEXT] !);
|
||||
if (viewAttachedToChangeDetector(embeddedLView)) {
|
||||
refreshView(
|
||||
embeddedLView, embeddedTView, embeddedTView.template, embeddedLView[CONTEXT] !);
|
||||
}
|
||||
}
|
||||
if ((activeIndexFlag & ActiveIndexFlag.HAS_TRANSPLANTED_VIEWS) !== 0) {
|
||||
// We should only CD moved views if the component where they were inserted does not match
|
||||
|
Reference in New Issue
Block a user