@meshmakers/shared-ui 3.4.490 → 3.4.500

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.
@@ -1435,6 +1435,9 @@ class MmListViewDataBindingDirective extends DataBindingDirective {
1435
1435
  });
1436
1436
  this._executeFilterSubscription = this.dataSource.listViewComponent.onExecuteFilter.subscribe((value) => {
1437
1437
  this._textSearchValue = value;
1438
+ // A changed search term changes the result set — the current page offset
1439
+ // would point into stale data (or past the end), so return to page 1.
1440
+ this.skip = 0;
1438
1441
  this.rebind();
1439
1442
  });
1440
1443
  this._refreshDataSubscription = this.dataSource.listViewComponent.onRefreshData.subscribe(() => {
@@ -1454,9 +1457,13 @@ class MmListViewDataBindingDirective extends DataBindingDirective {
1454
1457
  /**
1455
1458
  * Triggers a rebind when the filter state changes programmatically.
1456
1459
  * Syncs the grid's filter into the DataBindingDirective state before rebinding.
1460
+ * Resets `skip` to page 1: a changed filter changes the result set, so the
1461
+ * current page offset would point into stale data or past the end (Kendo's
1462
+ * own filter-row path does the same reset via its dataStateChange event).
1457
1463
  */
1458
1464
  notifyFilterChange(filter) {
1459
1465
  this.state.filter = filter;
1466
+ this.skip = 0;
1460
1467
  this.rebind();
1461
1468
  }
1462
1469
  /**
@@ -1475,6 +1482,12 @@ class MmListViewDataBindingDirective extends DataBindingDirective {
1475
1482
  if (!this.dataSource) {
1476
1483
  return;
1477
1484
  }
1485
+ // Cancel a still-running fetch before starting a new one. Without this,
1486
+ // overlapping fetches (sort/page click while a load is in flight, or the
1487
+ // autoPageSize measurement refetch) race: whichever response arrives LAST
1488
+ // wins, so a stale response could overwrite newer data — e.g. an unsorted
1489
+ // page replacing the sorted one the user just requested.
1490
+ this._serviceSubscription?.unsubscribe();
1478
1491
  // Only use dataSource.setLoading() (tracked via isLoading$ / isLoading signal).
1479
1492
  // Do NOT set grid.loading directly — it triggers Kendo's internal loading overlay.
1480
1493
  this.dataSource.setLoading(true);