@rxap/forms 13.0.2 → 13.0.3

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.
@@ -241,12 +241,18 @@ class RxapFormArray extends FormArray {
241
241
  // `undefined` as a value.
242
242
  if (value == null /* both `null` and `undefined` */)
243
243
  return;
244
+ const largesIndex = value.length === 0 ? -1 : Object.keys(value).map(Number).sort().reverse()[0];
244
245
  value.forEach((newValue, index) => {
245
- if (this.at(index)) {
246
- this.at(index).patchValue(newValue, { ...(options ?? {}), onlySelf: true });
246
+ if (options?.strict && index > largesIndex) {
247
+ this.removeAt(index);
247
248
  }
248
- else if (options?.coerce) {
249
- this.insertAt(index, value[index]);
249
+ else {
250
+ if (this.at(index)) {
251
+ this.at(index).patchValue(newValue, { ...(options ?? {}), onlySelf: true });
252
+ }
253
+ else if (options?.coerce) {
254
+ this.insertAt(index, value[index]);
255
+ }
250
256
  }
251
257
  });
252
258
  this.updateValueAndValidity(options);