fix(ivy): do not invoke change detection for destroyed views (#34241)

Prior to this commit, calling change detection for destroyed views resulted in errors being thrown in some cases. This commit adds a check to make sure change detection is invoked for non-destroyed views only.

PR Close #34241
This commit is contained in:
Andrew Kushnir
2019-12-04 14:10:50 -08:00
parent af36bc6ba3
commit 24bbcafe78
2 changed files with 56 additions and 2 deletions

View File

@ -380,8 +380,9 @@ export function renderView<T>(lView: LView, tView: TView, context: T): void {
export function refreshView<T>(
lView: LView, tView: TView, templateFn: ComponentTemplate<{}>| null, context: T) {
ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode');
enterView(lView, lView[T_HOST]);
const flags = lView[FLAGS];
if ((flags & LViewFlags.Destroyed) === LViewFlags.Destroyed) return;
enterView(lView, lView[T_HOST]);
try {
resetPreOrderHookFlags(lView);