@sumaris-net/ngx-components 21.3.3 → 21.3.4

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.
package/doc/changelog.md CHANGED
@@ -2441,3 +2441,8 @@ The library now uses the Ionic **standalone** build (`@ionic/angular/standalone`
2441
2441
  - fix(memory-entity-service): avoid entity duplication when saving hidden data (SUMARiS issue #2128 - lot duplicated in field mode, after leaving then reopening the screen):
2442
2442
  * `saveAll()` deduplicates visible data and `_hiddenData`, using the service `equals()` function
2443
2443
  * `fetchMore()` removes fetched items from `_hiddenData` using `equals()` instead of object identity (broken when `onLoad()` transforms entities)
2444
+
2445
+ ## 21.3.4
2446
+ - fix(observables): `firstPromise()` now resolves on the first value (using `first()`), instead of waiting for the observable to complete. A `Subject` never completes, so the promise was never resolved (no error)
2447
+ * e.g. `StartableObservableService.ready()` (and `InMemoryEntitiesService.ready()`) called before `start()` never resolved (SUMARiS: the taxon name buttons of the sub-batches burst form stayed empty, on mobile)
2448
+ - test(observables): add unit tests for `firstPromise()`
@@ -3151,7 +3151,9 @@ function firstNotNilPromise(obs, opts) {
3151
3151
  return firstNotNil(obs, { stopError: true, ...opts }).toPromise();
3152
3152
  }
3153
3153
  function firstPromise(obs, opts) {
3154
- return decorateWithTakeUntil(obs, { stopError: true, ...opts }).toPromise();
3154
+ return decorateWithTakeUntil(
3155
+ // Take the first value: toPromise() resolves only on complete (never for a Subject, e.g. a startSubject)
3156
+ obs.pipe(first()), { stopError: true, ...opts }).toPromise();
3155
3157
  }
3156
3158
  function chainPromises(defers) {
3157
3159
  return (defers || []).reduce((previous, defer) => {