@homebound/beam 2.244.2 → 2.244.4
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.
|
@@ -48,7 +48,7 @@ export declare class TableState {
|
|
|
48
48
|
setRows(rows: GridDataRow<any>[]): void;
|
|
49
49
|
setColumns(columns: GridColumnWithId<any>[], visibleColumnsStorageKey: string | undefined): void;
|
|
50
50
|
/** Determines which columns to expand immediately vs async */
|
|
51
|
-
parseAndUpdateExpandedColumns(columnsToExpand: GridColumnWithId<any>[]): void
|
|
51
|
+
parseAndUpdateExpandedColumns(columnsToExpand: GridColumnWithId<any>[]): Promise<void>;
|
|
52
52
|
/** Updates the state of which columns are expanded */
|
|
53
53
|
updateExpandedColumns(newColumns: GridColumnWithId<any>[]): void;
|
|
54
54
|
loadExpandedColumns(column: GridColumnWithId<any>): Promise<void>;
|
|
@@ -201,7 +201,7 @@ class TableState {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
/** Determines which columns to expand immediately vs async */
|
|
204
|
-
parseAndUpdateExpandedColumns(columnsToExpand) {
|
|
204
|
+
async parseAndUpdateExpandedColumns(columnsToExpand) {
|
|
205
205
|
// Separate out which columns need to be loaded async vs which can be loaded immediately.
|
|
206
206
|
const [localColumnsToExpand, asyncColumnsToExpand] = columnsToExpand.reduce((acc, c) => {
|
|
207
207
|
if ((0, utils_2.isFunction)(c.expandColumns)) {
|
|
@@ -212,7 +212,16 @@ class TableState {
|
|
|
212
212
|
// Handle all async expanding columns using a Promise.all.
|
|
213
213
|
// This will allow the table to render immediately, then cause a rerender with the new columns
|
|
214
214
|
if (asyncColumnsToExpand.length > 0) {
|
|
215
|
-
Promise.all
|
|
215
|
+
// Note: Not using a Promise.all because there seems to be a bug in Apollo with applying TypePolicies when using Promise.all.
|
|
216
|
+
// TODO: Update comment with Apollo issue link.
|
|
217
|
+
// Promise.all(asyncColumnsToExpand.map(async (c) => await this.loadExpandedColumns(c))).then(() =>
|
|
218
|
+
// this.updateExpandedColumns(asyncColumnsToExpand),
|
|
219
|
+
// );
|
|
220
|
+
// Instead, doing each async request in sequence for now.
|
|
221
|
+
for await (const column of asyncColumnsToExpand) {
|
|
222
|
+
await this.loadExpandedColumns(column);
|
|
223
|
+
}
|
|
224
|
+
this.updateExpandedColumns(asyncColumnsToExpand);
|
|
216
225
|
}
|
|
217
226
|
// For local columns, we skip the Promise in order to have the correct state on the initial load.
|
|
218
227
|
if (localColumnsToExpand.length > 0) {
|
|
@@ -43,6 +43,10 @@ function useComputed(fn, deps) {
|
|
|
43
43
|
});
|
|
44
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
45
|
}, deps);
|
|
46
|
+
// unsubscribe the autorun when we're unmounted
|
|
47
|
+
(0, react_1.useEffect)(() => {
|
|
48
|
+
return ref.current.runner;
|
|
49
|
+
}, []);
|
|
46
50
|
// Occasionally autorun will not have run yet, in which case we have to just
|
|
47
51
|
// accept running the eval fn twice (here to get the value for the 1st render,
|
|
48
52
|
// and again for mobx to watch what observables we touch).
|