ngx-eiffage-material 0.0.45 → 0.0.46

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.
@@ -3313,16 +3313,24 @@ class NgxPaginatedSelect {
3313
3313
  effect(() => {
3314
3314
  const items = this._selectedItems();
3315
3315
  const key = this.config().valueKey;
3316
+ // Drop items that don't carry the configured valueKey — otherwise we'd
3317
+ // push `undefined` into the FormControl, which JSON-serializes as `null`
3318
+ // and breaks downstream payloads silently.
3319
+ const validItems = items.filter(i => i != null && i[key] != null);
3320
+ if (validItems.length !== items.length) {
3321
+ console.warn('[NgxPaginatedSelect] Dropped selected items missing valueKey ' +
3322
+ `'${String(key)}'. Check the endpoint response or selectedItems input.`, items);
3323
+ }
3316
3324
  if (this.multiple()) {
3317
3325
  // Use null instead of [] so Validators.required flags empty selection correctly
3318
- this.control()?.setValue(items.length > 0 ? items.map(i => i[key]) : null);
3319
- this.valueChange.emit(items);
3326
+ this.control()?.setValue(validItems.length > 0 ? validItems.map(i => i[key]) : null);
3327
+ this.valueChange.emit(validItems);
3320
3328
  }
3321
3329
  else {
3322
- this.control()?.setValue(items[0]?.[key] ?? null);
3323
- this.valueChange.emit(items[0]);
3330
+ this.control()?.setValue(validItems[0]?.[key] ?? null);
3331
+ this.valueChange.emit(validItems[0]);
3324
3332
  }
3325
- this.selectionChange.emit(items);
3333
+ this.selectionChange.emit(validItems);
3326
3334
  this._cdr.markForCheck();
3327
3335
  });
3328
3336
  }