@meshmakers/shared-ui 3.4.730 → 3.4.740
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.
|
@@ -1396,8 +1396,18 @@ class DataSourceBase {
|
|
|
1396
1396
|
setLoading(loading) {
|
|
1397
1397
|
this._isLoading$.next(loading);
|
|
1398
1398
|
}
|
|
1399
|
-
fetchAgain() {
|
|
1400
|
-
this.fetchAgainEvent.emit();
|
|
1399
|
+
fetchAgain(options) {
|
|
1400
|
+
this.fetchAgainEvent.emit(options);
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Whether a failed fetch means the requested page offset lies beyond the
|
|
1404
|
+
* (shrunken) result set. MmListViewDataBindingDirective then recovers by
|
|
1405
|
+
* resetting to page 1 and refetching once instead of silently keeping the
|
|
1406
|
+
* previous rows on screen. Protocol-specific subclasses (e.g. the OctoMesh
|
|
1407
|
+
* GraphQL data source) override this; the default cannot tell and says no.
|
|
1408
|
+
*/
|
|
1409
|
+
isPageOutOfRangeError(_error) {
|
|
1410
|
+
return false;
|
|
1401
1411
|
}
|
|
1402
1412
|
}
|
|
1403
1413
|
|
|
@@ -1538,9 +1548,18 @@ class MmListViewDataBindingDirective extends DataBindingDirective {
|
|
|
1538
1548
|
if (!this.dataSource) {
|
|
1539
1549
|
return;
|
|
1540
1550
|
}
|
|
1541
|
-
this._fetchAgainSubscription = this.dataSource.fetchAgainEvent.subscribe(() => {
|
|
1551
|
+
this._fetchAgainSubscription = this.dataSource.fetchAgainEvent.subscribe((options) => {
|
|
1542
1552
|
this._forceRefresh = true;
|
|
1553
|
+
// A data source refetching because its own (bar/quick-view) filters
|
|
1554
|
+
// changed must return to page 1 — same invariant as notifyFilterChange()
|
|
1555
|
+
// and the text-search path. A plain refresh keeps the current page.
|
|
1556
|
+
if (options?.resetSkip) {
|
|
1557
|
+
this.skip = 0;
|
|
1558
|
+
}
|
|
1543
1559
|
this.rebind();
|
|
1560
|
+
if (options?.resetSkip) {
|
|
1561
|
+
this.persistState();
|
|
1562
|
+
}
|
|
1544
1563
|
});
|
|
1545
1564
|
this._executeFilterSubscription = this.dataSource.listViewComponent.onExecuteFilter.subscribe((value) => {
|
|
1546
1565
|
this._textSearchValue = value;
|
|
@@ -1693,6 +1712,18 @@ class MmListViewDataBindingDirective extends DataBindingDirective {
|
|
|
1693
1712
|
error: (err) => {
|
|
1694
1713
|
console.error('[MmListViewDataBinding] fetchData error:', err);
|
|
1695
1714
|
this.dataSource.setLoading(false);
|
|
1715
|
+
// A restored/stale page offset can lie beyond the current result set
|
|
1716
|
+
// (persisted skip + changed filters, or data shrunk since the last
|
|
1717
|
+
// visit) — the server rejects the fetch and the grid would silently
|
|
1718
|
+
// keep showing the PREVIOUS rows under the NEW filters. Recover by
|
|
1719
|
+
// returning to page 1 once; skip === 0 cannot be out of range, so
|
|
1720
|
+
// this cannot loop.
|
|
1721
|
+
if ((this.state.skip ?? 0) > 0 && this.dataSource.isPageOutOfRangeError(err)) {
|
|
1722
|
+
this.skip = 0;
|
|
1723
|
+
this._forceRefresh = true;
|
|
1724
|
+
this.rebind();
|
|
1725
|
+
this.persistState();
|
|
1726
|
+
}
|
|
1696
1727
|
}
|
|
1697
1728
|
});
|
|
1698
1729
|
}
|