ngx-eiffage-material 0.0.47 → 0.0.48

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.
@@ -3018,19 +3018,34 @@ class NgxPaginatedSelectBottomSheetComponent {
3018
3018
  }, ...(ngDevMode ? [{ debugName: "someSelected" }] : []));
3019
3019
  // ─── Accumulate pages ──────────────────────────────────────────────────────
3020
3020
  /**
3021
- * Only reads `resource.value()` — never `data.filters()`.
3021
+ * Reactively depends ONLY on `resource.value()`. The filter snapshot is read
3022
+ * via `untracked` so external filter changes (parent-driven, e.g. an extra
3023
+ * filters panel) do NOT create a reactive dependency here — that would make
3024
+ * the effect re-run on scroll page increments with stale resource data,
3025
+ * duplicating items and breaking `onScroll` (see original limitation).
3022
3026
  *
3023
- * When a query change or a new open resets to page 1 we call
3024
- * `accumulatedItems.set([])` synchronously *before* updating the filter,
3025
- * so by the time this effect fires with new data it always appends onto an
3026
- * already-clean array. Reading `data.filters()` here would cause the effect
3027
- * to run a second time (with stale resource data) the moment the page number
3028
- * is incremented on scroll, duplicating items and making
3029
- * `options().length >= total()` so `onScroll` would never fire again.
3027
+ * Reset logic:
3028
+ * - Fingerprint the current filter identity (everything except `pageNumber`).
3029
+ * - If the fingerprint changed since the previous fetch, this fetch belongs
3030
+ * to a different filter set → replace the accumulated array.
3031
+ * - If only `pageNumber` moved, this is a scroll-load-more → append.
3032
+ *
3033
+ * This is what allows callers to mutate `data.filters` from outside (extra
3034
+ * filter selects, checkboxes, etc.) and have the list refresh cleanly
3035
+ * without the previous page's items lingering.
3030
3036
  */
3037
+ _lastFilterFingerprint = null;
3031
3038
  _accumEffect = effect(() => {
3032
3039
  const value = this.resource.value();
3033
- this.accumulatedItems.update(acc => [...acc, ...value.items]);
3040
+ const { pageNumber: _pn, ...rest } = untracked(() => this.data.filters());
3041
+ const fingerprint = JSON.stringify(rest);
3042
+ if (fingerprint !== this._lastFilterFingerprint) {
3043
+ this._lastFilterFingerprint = fingerprint;
3044
+ this.accumulatedItems.set([...value.items]);
3045
+ }
3046
+ else {
3047
+ this.accumulatedItems.update(acc => [...acc, ...value.items]);
3048
+ }
3034
3049
  }, ...(ngDevMode ? [{ debugName: "_accumEffect" }] : []));
3035
3050
  constructor() {
3036
3051
  // Reset to page 1 when the sheet opens