@homebound/beam 2.308.0 → 2.308.1
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.
|
@@ -24,7 +24,7 @@ class ColumnState {
|
|
|
24
24
|
this.expanded = true;
|
|
25
25
|
this.doExpand();
|
|
26
26
|
}
|
|
27
|
-
(0, mobx_1.makeAutoObservable)(this, { column: mobx_1.observable.ref });
|
|
27
|
+
(0, mobx_1.makeAutoObservable)(this, { column: mobx_1.observable.ref }, { name: `ColumnState@${column.id}` });
|
|
28
28
|
}
|
|
29
29
|
setVisible(visible) {
|
|
30
30
|
const wasVisible = this.visible;
|
|
@@ -42,7 +42,7 @@ class RowState {
|
|
|
42
42
|
this.row = row;
|
|
43
43
|
this.selected = !!row.initSelected;
|
|
44
44
|
this.collapsed = (_a = states.storage.wasCollapsed(row.id)) !== null && _a !== void 0 ? _a : !!row.initCollapsed;
|
|
45
|
-
(0, mobx_1.makeAutoObservable)(this, { row: mobx_1.observable.ref });
|
|
45
|
+
(0, mobx_1.makeAutoObservable)(this, { row: mobx_1.observable.ref }, { name: `RowState@${row.id}` });
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Whether we match a client-side filter; true if no filter is in place.
|
|
@@ -234,9 +234,9 @@ class RowState {
|
|
|
234
234
|
.map((c) => (0, utils_1.applyRowFn)(c, this.row, api, 0, false))
|
|
235
235
|
.some((maybeContent) => (0, utils_1.matchesFilter)(maybeContent, term)));
|
|
236
236
|
}
|
|
237
|
-
/**
|
|
237
|
+
/** Used by node when doing `console.log(rs)`. */
|
|
238
238
|
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
239
|
-
return `RowState
|
|
239
|
+
return `RowState@${this.row.id}`;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
exports.RowState = RowState;
|
|
@@ -41,13 +41,25 @@ class RowStates {
|
|
|
41
41
|
* Any missing rows are marked as `wasRemoved` so we can consider them "kept" if they're also selected.
|
|
42
42
|
*/
|
|
43
43
|
setRows(rows) {
|
|
44
|
-
const existing = new Set(this.map.values());
|
|
45
44
|
const states = this;
|
|
46
45
|
const map = this.map;
|
|
46
|
+
// Keep track of ids as we add them, to detect duplicates
|
|
47
|
+
const seenIds = new Set();
|
|
48
|
+
// Keep track of existing rows, so we can mark any that are missing as removed
|
|
49
|
+
const maybeKept = new Set(this.map.values());
|
|
47
50
|
function addRowAndChildren(parent, row) {
|
|
48
51
|
var _a;
|
|
49
|
-
// This should really be kind+id, but
|
|
52
|
+
// This should really be kind+id, but nearly all of our existing API uses just ids,
|
|
53
|
+
// b/c we assume our ids are tagged/unique across parent/child kinds anyway. So go
|
|
54
|
+
// ahead and enforce "row.id must be unique across kinds" b/c pragmatically that is
|
|
55
|
+
// baked into the current API signatures.
|
|
50
56
|
const key = row.id;
|
|
57
|
+
if (seenIds.has(key)) {
|
|
58
|
+
throw new Error(`Duplicate row id ${key}`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
seenIds.add(key);
|
|
62
|
+
}
|
|
51
63
|
let state = map.get(key);
|
|
52
64
|
if (!state) {
|
|
53
65
|
state = new RowState_1.RowState(states, parent, row);
|
|
@@ -57,7 +69,7 @@ class RowStates {
|
|
|
57
69
|
state.parent = parent;
|
|
58
70
|
state.row = row;
|
|
59
71
|
state.removed = false;
|
|
60
|
-
|
|
72
|
+
maybeKept.delete(state);
|
|
61
73
|
}
|
|
62
74
|
state.children = (_a = row.children) === null || _a === void 0 ? void 0 : _a.map((child) => addRowAndChildren(state, child));
|
|
63
75
|
return state;
|
|
@@ -72,7 +84,7 @@ class RowStates {
|
|
|
72
84
|
// from messing up "header is all selected" if its hidden/when there are no kept rows.
|
|
73
85
|
this.header.children = [this.keptGroupRow, ...this.topRows];
|
|
74
86
|
// Then mark any remaining as removed
|
|
75
|
-
for (const state of
|
|
87
|
+
for (const state of maybeKept)
|
|
76
88
|
state.markRemoved();
|
|
77
89
|
// After the first load of real data, we detach collapse state, to respect
|
|
78
90
|
// any incoming initCollapsed.
|