Skip to content

Commit

Permalink
Respect default filter in GridModel.restoreDefaultsAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
ghsolomon committed Jan 17, 2025
1 parent 819a084 commit 9a84dde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### 🐞 Bug Fixes

* Fixed `ViewManagerModel` unique name validation.
* `GridModel.restoreDefaultsAsync()` now restores default filter rather than simply clearing it.

### ⚙️ Technical

Expand Down
5 changes: 3 additions & 2 deletions cmp/grid/GridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ export class GridModel extends HoistModel {
this.colChooserModel = this.parseChooserModel(colChooserModel);
this.selModel = this.parseSelModel(selModel);
this.filterModel = this.parseFilterModel(filterModel);
if (this.filterModel) this._defaultState.filter = this.filterModel.filter;
if (persistWith) initPersist(this, persistWith);
this.experimental = this.parseExperimental(experimental);
this.onKeyDown = onKeyDown;
Expand Down Expand Up @@ -644,12 +645,12 @@ export class GridModel extends HoistModel {
if (!confirmed) return false;
}

const {columns, sortBy, groupBy} = this._defaultState;
const {columns, sortBy, groupBy, filter} = this._defaultState;
this.setColumns(columns);
this.setSortBy(sortBy);
this.setGroupBy(groupBy);

this.filterModel?.clear();
this.filterModel?.setFilter(filter);

if (this.autosizeOptions.mode === 'managed') {
await this.autosizeAsync();
Expand Down

0 comments on commit 9a84dde

Please sign in to comment.