@angular/forms 21.1.0 → 21.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.0
2
+ * @license Angular v21.1.2
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1278,9 +1278,10 @@ class FieldNode {
1278
1278
  return this.metadataState.has(key);
1279
1279
  }
1280
1280
  markAsTouched() {
1281
- this.nodeState.markAsTouched();
1282
- this.pendingSync()?.abort();
1283
- this.sync();
1281
+ untracked(() => {
1282
+ this.nodeState.markAsTouched();
1283
+ this.flushSync();
1284
+ });
1284
1285
  }
1285
1286
  markAsDirty() {
1286
1287
  this.nodeState.markAsDirty();
@@ -1299,13 +1300,22 @@ class FieldNode {
1299
1300
  }
1300
1301
  }
1301
1302
  setControlValue(newValue) {
1302
- this._controlValue.set(newValue);
1303
- this.markAsDirty();
1304
- this.debounceSync();
1303
+ untracked(() => {
1304
+ this._controlValue.set(newValue);
1305
+ this.markAsDirty();
1306
+ this.debounceSync();
1307
+ });
1305
1308
  }
1306
1309
  sync() {
1307
1310
  this.value.set(this.controlValue());
1308
1311
  }
1312
+ flushSync() {
1313
+ const pending = this.pendingSync();
1314
+ if (pending && !pending.signal.aborted) {
1315
+ pending.abort();
1316
+ this.sync();
1317
+ }
1318
+ }
1309
1319
  async debounceSync() {
1310
1320
  this.pendingSync()?.abort();
1311
1321
  const debouncer = this.nodeState.debouncer();
@@ -1547,8 +1557,11 @@ function applyWhenValue(path, predicate, schema) {
1547
1557
  }
1548
1558
  async function submit(form, action) {
1549
1559
  const node = form();
1550
- markAllAsTouched(node);
1551
- if (node.invalid()) {
1560
+ const invalid = untracked(() => {
1561
+ markAllAsTouched(node);
1562
+ return node.invalid();
1563
+ });
1564
+ if (invalid) {
1552
1565
  return;
1553
1566
  }
1554
1567
  node.submitState.selfSubmitting.set(true);
@@ -1582,6 +1595,9 @@ function schema(fn) {
1582
1595
  return SchemaImpl.create(fn);
1583
1596
  }
1584
1597
  function markAllAsTouched(node) {
1598
+ if (node.validationState.shouldSkipValidation()) {
1599
+ return;
1600
+ }
1585
1601
  node.markAsTouched();
1586
1602
  for (const child of node.structure.children()) {
1587
1603
  markAllAsTouched(child);