@@ -594,6 +594,9 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
594
594
get status ( ) : FormControlStatus {
595
595
return untracked ( this . statusReactive ) ! ;
596
596
}
597
+ private set status ( v : FormControlStatus ) {
598
+ untracked ( ( ) => this . statusReactive . set ( v ) ) ;
599
+ }
597
600
/** @internal */
598
601
readonly _status = computed ( ( ) => this . statusReactive ( ) ) ;
599
602
private readonly statusReactive = signal < FormControlStatus | undefined > ( undefined ) ;
@@ -678,6 +681,9 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
678
681
get pristine ( ) : boolean {
679
682
return untracked ( this . pristineReactive ) ;
680
683
}
684
+ private set pristine ( v : boolean ) {
685
+ untracked ( ( ) => this . pristineReactive . set ( v ) ) ;
686
+ }
681
687
/** @internal */
682
688
readonly _pristine = computed ( ( ) => this . pristineReactive ( ) ) ;
683
689
private readonly pristineReactive = signal ( true ) ;
@@ -702,6 +708,9 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
702
708
get touched ( ) : boolean {
703
709
return untracked ( this . touchedReactive ) ;
704
710
}
711
+ private set touched ( v : boolean ) {
712
+ untracked ( ( ) => this . touchedReactive . set ( v ) ) ;
713
+ }
705
714
/** @internal */
706
715
readonly _touched = computed ( ( ) => this . touchedReactive ( ) ) ;
707
716
private readonly touchedReactive = signal ( false ) ;
@@ -970,7 +979,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
970
979
opts : { onlySelf ?: boolean ; emitEvent ?: boolean ; sourceControl ?: AbstractControl } = { } ,
971
980
) : void {
972
981
const changed = this . touched === false ;
973
- untracked ( ( ) => this . touchedReactive . set ( true ) ) ;
982
+ this . touched = true ;
974
983
975
984
const sourceControl = opts . sourceControl ?? this ;
976
985
if ( this . _parent && ! opts . onlySelf ) {
@@ -1030,7 +1039,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1030
1039
opts : { onlySelf ?: boolean ; emitEvent ?: boolean ; sourceControl ?: AbstractControl } = { } ,
1031
1040
) : void {
1032
1041
const changed = this . touched === true ;
1033
- untracked ( ( ) => this . touchedReactive . set ( false ) ) ;
1042
+ this . touched = false ;
1034
1043
this . _pendingTouched = false ;
1035
1044
1036
1045
const sourceControl = opts . sourceControl ?? this ;
@@ -1076,7 +1085,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1076
1085
opts : { onlySelf ?: boolean ; emitEvent ?: boolean ; sourceControl ?: AbstractControl } = { } ,
1077
1086
) : void {
1078
1087
const changed = this . pristine === true ;
1079
- untracked ( ( ) => this . pristineReactive . set ( false ) ) ;
1088
+ this . pristine = false ;
1080
1089
1081
1090
const sourceControl = opts . sourceControl ?? this ;
1082
1091
if ( this . _parent && ! opts . onlySelf ) {
@@ -1120,7 +1129,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1120
1129
opts : { onlySelf ?: boolean ; emitEvent ?: boolean ; sourceControl ?: AbstractControl } = { } ,
1121
1130
) : void {
1122
1131
const changed = this . pristine === false ;
1123
- untracked ( ( ) => this . pristineReactive . set ( true ) ) ;
1132
+ this . pristine = true ;
1124
1133
this . _pendingDirty = false ;
1125
1134
1126
1135
const sourceControl = opts . sourceControl ?? this ;
@@ -1167,7 +1176,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1167
1176
markAsPending (
1168
1177
opts : { onlySelf ?: boolean ; emitEvent ?: boolean ; sourceControl ?: AbstractControl } = { } ,
1169
1178
) : void {
1170
- untracked ( ( ) => this . statusReactive . set ( PENDING ) ) ;
1179
+ this . status = PENDING ;
1171
1180
1172
1181
const sourceControl = opts . sourceControl ?? this ;
1173
1182
if ( opts . emitEvent !== false ) {
@@ -1209,7 +1218,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1209
1218
// parent's dirtiness based on the children.
1210
1219
const skipPristineCheck = this . _parentMarkedDirty ( opts . onlySelf ) ;
1211
1220
1212
- untracked ( ( ) => this . statusReactive . set ( DISABLED ) ) ;
1221
+ this . status = DISABLED ;
1213
1222
( this as Writable < this> ) . errors = null ;
1214
1223
this . _forEachChild ( ( control : AbstractControl ) => {
1215
1224
/** We don't propagate the source control downwards */
@@ -1252,7 +1261,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1252
1261
// parent's dirtiness based on the children.
1253
1262
const skipPristineCheck = this . _parentMarkedDirty ( opts . onlySelf ) ;
1254
1263
1255
- untracked ( ( ) => this . statusReactive . set ( VALID ) ) ;
1264
+ this . status = VALID ;
1256
1265
this . _forEachChild ( ( control : AbstractControl ) => {
1257
1266
control . enable ( { ...opts , onlySelf : true } ) ;
1258
1267
} ) ;
@@ -1340,7 +1349,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1340
1349
const shouldHaveEmitted = this . _cancelExistingSubscription ( ) ;
1341
1350
1342
1351
( this as Writable < this> ) . errors = this . _runValidator ( ) ;
1343
- untracked ( ( ) => this . statusReactive . set ( this . _calculateStatus ( ) ) ) ;
1352
+ this . status = this . _calculateStatus ( ) ;
1344
1353
1345
1354
if ( this . status === VALID || this . status === PENDING ) {
1346
1355
// If the canceled subscription should have emitted
@@ -1369,7 +1378,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1369
1378
}
1370
1379
1371
1380
private _setInitialStatus ( ) {
1372
- untracked ( ( ) => this . statusReactive . set ( this . _allControlsDisabled ( ) ? DISABLED : VALID ) ) ;
1381
+ this . status = this . _allControlsDisabled ( ) ? DISABLED : VALID ;
1373
1382
}
1374
1383
1375
1384
private _runValidator ( ) : ValidationErrors | null {
@@ -1378,7 +1387,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1378
1387
1379
1388
private _runAsyncValidator ( shouldHaveEmitted : boolean , emitEvent ?: boolean ) : void {
1380
1389
if ( this . asyncValidator ) {
1381
- untracked ( ( ) => this . statusReactive . set ( PENDING ) ) ;
1390
+ this . status = PENDING ;
1382
1391
this . _hasOwnPendingAsyncValidator = { emitEvent : emitEvent !== false } ;
1383
1392
const obs = toObservable ( this . asyncValidator ( this ) ) ;
1384
1393
this . _asyncValidationSubscription = obs . subscribe ( ( errors : ValidationErrors | null ) => {
@@ -1594,7 +1603,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1594
1603
changedControl : AbstractControl ,
1595
1604
shouldHaveEmitted ?: boolean ,
1596
1605
) : void {
1597
- untracked ( ( ) => this . statusReactive . set ( this . _calculateStatus ( ) ) ) ;
1606
+ this . status = this . _calculateStatus ( ) ;
1598
1607
1599
1608
if ( emitEvent ) {
1600
1609
( this . statusChanges as EventEmitter < FormControlStatus > ) . emit ( this . status ) ;
@@ -1660,7 +1669,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1660
1669
_updatePristine ( opts : { onlySelf ?: boolean } , changedControl : AbstractControl ) : void {
1661
1670
const newPristine = ! this . _anyControlsDirty ( ) ;
1662
1671
const changed = this . pristine !== newPristine ;
1663
- untracked ( ( ) => this . pristineReactive . set ( newPristine ) ) ;
1672
+ this . pristine = newPristine ;
1664
1673
1665
1674
if ( this . _parent && ! opts . onlySelf ) {
1666
1675
this . _parent . _updatePristine ( opts , changedControl ) ;
@@ -1673,7 +1682,7 @@ export abstract class AbstractControl<TValue = any, TRawValue extends TValue = T
1673
1682
1674
1683
/** @internal */
1675
1684
_updateTouched ( opts : { onlySelf ?: boolean } = { } , changedControl : AbstractControl ) : void {
1676
- untracked ( ( ) => this . touchedReactive . set ( this . _anyControlsTouched ( ) ) ) ;
1685
+ this . touched = this . _anyControlsTouched ( ) ;
1677
1686
this . _events . next ( new TouchedChangeEvent ( this . touched , changedControl ) ) ;
1678
1687
1679
1688
if ( this . _parent && ! opts . onlySelf ) {
0 commit comments