@homebound/beam 2.273.0 → 2.274.0

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.
@@ -42,7 +42,6 @@ export type GridTableApi<R extends Kinded> = {
42
42
  isCollapsedRow: (id: string) => boolean;
43
43
  setVisibleColumns: (ids: string[]) => void;
44
44
  getVisibleColumnIds: () => string[];
45
- refetchExpandedColumns: () => void;
46
45
  };
47
46
  export declare class GridTableApiImpl<R extends Kinded> implements GridTableApi<R> {
48
47
  readonly tableState: TableState;
@@ -60,5 +59,4 @@ export declare class GridTableApiImpl<R extends Kinded> implements GridTableApi<
60
59
  isCollapsedRow(id: string): boolean;
61
60
  setVisibleColumns(ids: string[]): void;
62
61
  getVisibleColumnIds(): string[];
63
- refetchExpandedColumns(): void;
64
62
  }
@@ -77,8 +77,5 @@ class GridTableApiImpl {
77
77
  getVisibleColumnIds() {
78
78
  return this.tableState.visibleColumnIds;
79
79
  }
80
- refetchExpandedColumns() {
81
- this.tableState.refetchExpandedColumns();
82
- }
83
80
  }
84
81
  exports.GridTableApiImpl = GridTableApiImpl;
@@ -47,7 +47,6 @@ export declare class TableState {
47
47
  get sortState(): SortState | undefined;
48
48
  setRows(rows: GridDataRow<any>[]): void;
49
49
  setColumns(columns: GridColumnWithId<any>[], visibleColumnsStorageKey: string | undefined): void;
50
- refetchExpandedColumns(): void;
51
50
  /** Determines which columns to expand immediately vs async */
52
51
  parseAndUpdateExpandedColumns(columnsToExpand: GridColumnWithId<any>[]): Promise<void>;
53
52
  /** Updates the state of which columns are expanded */
@@ -188,22 +188,19 @@ class TableState {
188
188
  // Figure out which columns need to be expanded when rendering a new set of columns
189
189
  const localStorageColumns = this.persistCollapse ? readExpandedColumnsStorage(this.persistCollapse) : [];
190
190
  // On initial render the columns we start with is whatever is in local storage.
191
- // On any subsequent render, we start with an empty array.
192
- // (We'll add to this after figuring out which columns are new vs existing.)
193
- const columnIdsToExpand = isInitial ? localStorageColumns : [];
191
+ // On subsequent renders we want to keep the columns that were previously expanded.
192
+ const columnIdsToExpand = isInitial ? localStorageColumns : this.expandedColumnIds;
194
193
  // Create a list of all existing column ids. (We ignore the `initExpanded` property for existing columns)
195
194
  const existingColumnIds = this.columns.map((c) => c.id);
196
195
  // Add any columns to our array that are new columns that should be initially expanded.
197
196
  columnIdsToExpand.push(...columns.filter((c) => !existingColumnIds.includes(c.id) && c.initExpanded).map((c) => c.id));
197
+ // Clear the cache to force to re-fetch the expanded columns.
198
+ this.loadedColumns.clear();
198
199
  // Send the new array of columns along to be parsed and expanded.
199
200
  this.parseAndUpdateExpandedColumns(columns.filter((c) => columnIdsToExpand.includes(c.id)));
200
201
  this.columns = columns;
201
202
  }
202
203
  }
203
- refetchExpandedColumns() {
204
- this.loadedColumns.clear();
205
- this.parseAndUpdateExpandedColumns(this.columns.filter((c) => this.expandedColumnIds.includes(c.id)));
206
- }
207
204
  /** Determines which columns to expand immediately vs async */
208
205
  async parseAndUpdateExpandedColumns(columnsToExpand) {
209
206
  // Separate out which columns need to be loaded async vs which can be loaded immediately.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.273.0",
3
+ "version": "2.274.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",