@homebound/beam 2.118.1 → 2.118.2
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.
|
@@ -240,7 +240,7 @@ function GridTable(props) {
|
|
|
240
240
|
tooManyClientSideRows = true;
|
|
241
241
|
filteredRows = filteredRows.slice(0, filterMaxRows);
|
|
242
242
|
}
|
|
243
|
-
rowState.
|
|
243
|
+
rowState.setVisibleRows(filteredRows.map(([row]) => { var _a; return (_a = row === null || row === void 0 ? void 0 : row.id) !== null && _a !== void 0 ? _a : ""; }));
|
|
244
244
|
// Push back to the caller a way to ask us where a row is.
|
|
245
245
|
const { rowLookup } = props;
|
|
246
246
|
if (rowLookup) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ObservableSet } from "mobx";
|
|
2
1
|
import React, { MutableRefObject } from "react";
|
|
3
2
|
import { GridDataRow } from "./GridTable";
|
|
4
3
|
export declare type SelectedState = "checked" | "unchecked" | "partial";
|
|
@@ -22,12 +21,13 @@ export declare class RowState {
|
|
|
22
21
|
private persistCollapse;
|
|
23
22
|
private readonly collapsedRows;
|
|
24
23
|
private readonly selectedRows;
|
|
25
|
-
visibleRows
|
|
24
|
+
private visibleRows;
|
|
26
25
|
activeRowId: string | undefined;
|
|
27
26
|
/**
|
|
28
27
|
* Creates the `RowState` for a given `GridTable`.
|
|
29
28
|
*/
|
|
30
29
|
constructor(rows: MutableRefObject<GridDataRow<any>[]>, persistCollapse: string | undefined, activeRowId: string | undefined);
|
|
30
|
+
setVisibleRows(rowIds: string[]): void;
|
|
31
31
|
get selectedIds(): string[];
|
|
32
32
|
getSelected(id: string): SelectedState;
|
|
33
33
|
selectRow(id: string, selected: boolean): void;
|
|
@@ -45,6 +45,16 @@ class RowState {
|
|
|
45
45
|
this.selectedRows.merge(map);
|
|
46
46
|
}, { equals: mobx_1.comparer.shallow });
|
|
47
47
|
}
|
|
48
|
+
setVisibleRows(rowIds) {
|
|
49
|
+
// ObservableSet doesn't seem to do a `diff` inside `replace` before firing
|
|
50
|
+
// observers/reactions that watch it, which can lead to render loops with the
|
|
51
|
+
// application page is observing `GridTableApi.getSelectedRows`, and merely
|
|
52
|
+
// the act of rendering GridTable (w/o row changes) causes it's `useComputed`
|
|
53
|
+
// to be triggered.
|
|
54
|
+
if (!mobx_1.comparer.shallow(rowIds, [...this.visibleRows.values()])) {
|
|
55
|
+
this.visibleRows.replace(rowIds);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
48
58
|
get selectedIds() {
|
|
49
59
|
// Return only ids that are fully checked, i.e. not partial
|
|
50
60
|
const ids = [...this.selectedRows.entries()]
|