perf(core): use `ngDevMode` to tree-shake `checkNoChanges` (#39964) · angular/angular@2fbb684

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -12,7 +12,7 @@

1212

"master": {

1313

"uncompressed": {

1414

"runtime-es2015": 3033,

15-

"main-es2015": 447343,

15+

"main-es2015": 446749,

1616

"polyfills-es2015": 52493

1717

}

1818

}

Original file line numberDiff line numberDiff line change

@@ -3,7 +3,7 @@

33

"master": {

44

"uncompressed": {

55

"runtime-es2015": 1485,

6-

"main-es2015": 140899,

6+

"main-es2015": 134899,

77

"polyfills-es2015": 36571

88

}

99

}

Original file line numberDiff line numberDiff line change

@@ -573,7 +573,6 @@ export class ApplicationRef {

573573

private _bootstrapListeners: ((compRef: ComponentRef<any>) => void)[] = [];

574574

private _views: InternalViewRef[] = [];

575575

private _runningTick: boolean = false;

576-

private _enforceNoNewChanges: boolean = false;

577576

private _stable = true;

578577

private _onMicrotaskEmptySubscription: Subscription;

579578

@@ -602,8 +601,6 @@ export class ApplicationRef {

602601

private _exceptionHandler: ErrorHandler,

603602

private _componentFactoryResolver: ComponentFactoryResolver,

604603

private _initStatus: ApplicationInitStatus) {

605-

this._enforceNoNewChanges = isDevMode();

606-
607604

this._onMicrotaskEmptySubscription = this._zone.onMicrotaskEmpty.subscribe({

608605

next: () => {

609606

this._zone.run(() => {

@@ -740,7 +737,9 @@ export class ApplicationRef {

740737

for (let view of this._views) {

741738

view.detectChanges();

742739

}

743-

if (this._enforceNoNewChanges) {

740+

// Note that we have still left the `isDevMode()` condition in order to avoid

741+

// creating a breaking change for projects that still use the View Engine.

742+

if ((typeof ngDevMode === 'undefined' || ngDevMode) && isDevMode()) {

744743

for (let view of this._views) {

745744

view.checkNoChanges();

746745

}