perf(core): use `ngDevMode` to tree-shake `checkNoChanges` (#39964)
This commit adds `ngDevMode` guard to run `checkNoChanges` only in dev mode (similar to how things work in other parts of Ivy runtime code). The `ngDevMode` flag helps to tree-shake this code from production builds (in dev mode everything will work as it works right now) to decrease production bundle size. PR Close #39964
This commit is contained in:
parent
d2042a0da2
commit
e1fe9ecffe
|
@ -12,7 +12,7 @@
|
||||||
"master": {
|
"master": {
|
||||||
"uncompressed": {
|
"uncompressed": {
|
||||||
"runtime-es2015": 3033,
|
"runtime-es2015": 3033,
|
||||||
"main-es2015": 447975,
|
"main-es2015": 447349,
|
||||||
"polyfills-es2015": 52493
|
"polyfills-es2015": 52493
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"master": {
|
"master": {
|
||||||
"uncompressed": {
|
"uncompressed": {
|
||||||
"runtime-es2015": 1485,
|
"runtime-es2015": 1485,
|
||||||
"main-es2015": 141516,
|
"main-es2015": 140921,
|
||||||
"polyfills-es2015": 36964
|
"polyfills-es2015": 36964
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -597,7 +597,6 @@ export class ApplicationRef {
|
||||||
private _bootstrapListeners: ((compRef: ComponentRef<any>) => void)[] = [];
|
private _bootstrapListeners: ((compRef: ComponentRef<any>) => void)[] = [];
|
||||||
private _views: InternalViewRef[] = [];
|
private _views: InternalViewRef[] = [];
|
||||||
private _runningTick: boolean = false;
|
private _runningTick: boolean = false;
|
||||||
private _enforceNoNewChanges: boolean = false;
|
|
||||||
private _stable = true;
|
private _stable = true;
|
||||||
private _onMicrotaskEmptySubscription: Subscription;
|
private _onMicrotaskEmptySubscription: Subscription;
|
||||||
|
|
||||||
|
@ -626,8 +625,6 @@ export class ApplicationRef {
|
||||||
private _exceptionHandler: ErrorHandler,
|
private _exceptionHandler: ErrorHandler,
|
||||||
private _componentFactoryResolver: ComponentFactoryResolver,
|
private _componentFactoryResolver: ComponentFactoryResolver,
|
||||||
private _initStatus: ApplicationInitStatus) {
|
private _initStatus: ApplicationInitStatus) {
|
||||||
this._enforceNoNewChanges = isDevMode();
|
|
||||||
|
|
||||||
this._onMicrotaskEmptySubscription = this._zone.onMicrotaskEmpty.subscribe({
|
this._onMicrotaskEmptySubscription = this._zone.onMicrotaskEmpty.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this._zone.run(() => {
|
this._zone.run(() => {
|
||||||
|
@ -764,7 +761,9 @@ export class ApplicationRef {
|
||||||
for (let view of this._views) {
|
for (let view of this._views) {
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
}
|
}
|
||||||
if (this._enforceNoNewChanges) {
|
// Note that we have still left the `isDevMode()` condition in order to avoid
|
||||||
|
// creating a breaking change for projects that still use the View Engine.
|
||||||
|
if ((typeof ngDevMode === 'undefined' || ngDevMode) && isDevMode()) {
|
||||||
for (let view of this._views) {
|
for (let view of this._views) {
|
||||||
view.checkNoChanges();
|
view.checkNoChanges();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue