GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(forms): use `ngDevMode` to tree-shake `_ngModelWarning` (#39964) · angular/angular@735556d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/forms/src/directives
    • reactive_directives
      • form_control_directive.ts
      • form_control_name.ts
    • shared.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/forms/src/directives/reactive_directives/form_control_directive.ts‎

Copy file name to clipboardExpand all lines: packages/forms/src/directives/reactive_directives/form_control_directive.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ export class FormControlDirective extends NgControl implements OnChanges {
125125
this.form.updateValueAndValidity({emitEvent: false});
126126
}
127127
if (isPropertyUpdated(changes, this.viewModel)) {
128-
_ngModelWarning('formControl', FormControlDirective, this, this._ngModelWarningConfig);
128+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
129+
_ngModelWarning('formControl', FormControlDirective, this, this._ngModelWarningConfig);
130+
}
129131
this.form.setValue(this.model);
130132
this.viewModel = this.model;
131133
}
Collapse file

‎packages/forms/src/directives/reactive_directives/form_control_name.ts‎

Copy file name to clipboardExpand all lines: packages/forms/src/directives/reactive_directives/form_control_name.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy {
145145
ngOnChanges(changes: SimpleChanges) {
146146
if (!this._added) this._setUpControl();
147147
if (isPropertyUpdated(changes, this.viewModel)) {
148-
_ngModelWarning('formControlName', FormControlName, this, this._ngModelWarningConfig);
148+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
149+
_ngModelWarning('formControlName', FormControlName, this, this._ngModelWarningConfig);
150+
}
149151
this.viewModel = this.model;
150152
this.formDirective.updateModel(this, this.model);
151153
}
Collapse file

‎packages/forms/src/directives/shared.ts‎

Copy file name to clipboardExpand all lines: packages/forms/src/directives/shared.ts
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {isDevMode} from '@angular/core';
10-
119
import {AbstractControl, FormArray, FormControl, FormGroup} from '../model';
1210
import {getControlAsyncValidators, getControlValidators, mergeValidators} from '../validators';
1311

@@ -324,13 +322,11 @@ export function removeListItem<T>(list: T[], el: T): void {
324322
export function _ngModelWarning(
325323
name: string, type: {_ngModelWarningSentOnce: boolean},
326324
instance: {_ngModelWarningSent: boolean}, warningConfig: string|null) {
327-
if (!isDevMode() || warningConfig === 'never') return;
325+
if (warningConfig === 'never') return;
328326

329327
if (((warningConfig === null || warningConfig === 'once') && !type._ngModelWarningSentOnce) ||
330328
(warningConfig === 'always' && !instance._ngModelWarningSent)) {
331-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
332-
ReactiveErrors.ngModelWarning(name);
333-
}
329+
ReactiveErrors.ngModelWarning(name);
334330
type._ngModelWarningSentOnce = true;
335331
instance._ngModelWarningSent = true;
336332
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.