diff --git a/packages/core/src/change_detection/flags.ts b/packages/core/src/change_detection/flags.ts index 0c816a7573be3..85ed449034616 100644 --- a/packages/core/src/change_detection/flags.ts +++ b/packages/core/src/change_detection/flags.ts @@ -6,8 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ -// TODO(atscott): flip default internally ASAP and externally for v18 (#52928) -let _ensureDirtyViewsAreAlwaysReachable = false; +// TODO(atscott): Remove prior to v18 release. Keeping this around in case anyone internally needs +// to opt out temporarily. +let _ensureDirtyViewsAreAlwaysReachable = true; export function getEnsureDirtyViewsAreAlwaysReachable() { return _ensureDirtyViewsAreAlwaysReachable; diff --git a/packages/core/test/acceptance/change_detection_spec.ts b/packages/core/test/acceptance/change_detection_spec.ts index 16ba8f3aaca94..176a1fa14fe52 100644 --- a/packages/core/test/acceptance/change_detection_spec.ts +++ b/packages/core/test/acceptance/change_detection_spec.ts @@ -8,7 +8,7 @@ import {CommonModule} from '@angular/common'; -import {ApplicationRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentRef, Directive, DoCheck, EmbeddedViewRef, ErrorHandler, EventEmitter, inject, Input, NgModule, OnInit, Output, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef, ɵgetEnsureDirtyViewsAreAlwaysReachable, ɵsetEnsureDirtyViewsAreAlwaysReachable} from '@angular/core'; +import {ApplicationRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentRef, Directive, DoCheck, EmbeddedViewRef, ErrorHandler, EventEmitter, inject, Input, NgModule, OnInit, Output, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef} from '@angular/core'; import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; import {expect} from '@angular/platform-browser/testing/src/matchers'; import {BehaviorSubject} from 'rxjs'; @@ -184,8 +184,6 @@ describe('change detection', () => { describe('markForCheck', () => { it('should mark OnPush ancestor of dynamically created component views as dirty', () => { - const previous = ɵgetEnsureDirtyViewsAreAlwaysReachable(); - ɵsetEnsureDirtyViewsAreAlwaysReachable(true); @Component({ selector: `test-cmpt`, template: `{{counter}}|`, @@ -245,7 +243,6 @@ describe('change detection', () => { dynamicCmptRef.changeDetectorRef.reattach(); fixture.detectChanges(false); expect(fixture.nativeElement).toHaveText('1|dynamic|updatedBinding'); - ɵsetEnsureDirtyViewsAreAlwaysReachable(previous); }); it('should support re-enterant change detection', () => { diff --git a/packages/core/test/linker/change_detection_integration_spec.ts b/packages/core/test/linker/change_detection_integration_spec.ts index 590d1865320a5..805399e073e92 100644 --- a/packages/core/test/linker/change_detection_integration_spec.ts +++ b/packages/core/test/linker/change_detection_integration_spec.ts @@ -7,7 +7,7 @@ */ import {ResourceLoader} from '@angular/compiler'; -import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, DebugElement, Directive, DoCheck, EventEmitter, HostBinding, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, Provider, RendererFactory2, RendererType2, SimpleChange, SimpleChanges, TemplateRef, Type, ViewChild, ViewContainerRef, ɵgetEnsureDirtyViewsAreAlwaysReachable, ɵsetEnsureDirtyViewsAreAlwaysReachable} from '@angular/core'; +import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, DebugElement, Directive, DoCheck, EventEmitter, HostBinding, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, Provider, RendererFactory2, RendererType2, SimpleChange, SimpleChanges, TemplateRef, Type, ViewChild, ViewContainerRef} from '@angular/core'; import {ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser/src/dom/debug/by'; import {isTextNode} from '@angular/platform-browser/testing/src/browser_util'; @@ -1136,13 +1136,10 @@ describe(`ChangeDetection`, () => { })); it('should allow view to be created in a cd hook', () => { - const previous = ɵgetEnsureDirtyViewsAreAlwaysReachable(); - ɵsetEnsureDirtyViewsAreAlwaysReachable(true); const ctx = createCompFixture('
{{ a }}
', TestData); ctx.componentInstance.a = 1; ctx.detectChanges(); expect(ctx.nativeElement.innerText).toEqual('1'); - ɵsetEnsureDirtyViewsAreAlwaysReachable(previous); }); it('should not throw when two arrays are structurally the same', fakeAsync(() => {