Skip to content

Commit

Permalink
[DataGrid] Fix delete filter inconsistent behavior (#13353)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Cherniavskyi <[email protected]>
  • Loading branch information
oukunan and cherniavskii committed Jul 12, 2024
1 parent ee1ce3e commit c0af84d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,7 @@ const GridFilterForm = React.forwardRef<HTMLDivElement, GridFilterFormProps>(
);

const handleDeleteFilter = () => {
if (rootProps.disableMultipleColumnsFiltering) {
if (item.value === undefined) {
deleteFilter(item);
} else {
// TODO v6: simplify the behavior by always remove the filter form
applyFilterChanges({ ...item, value: undefined });
}
} else {
deleteFilter(item);
}
deleteFilter(item);
};

React.useImperativeHandle(
Expand Down
4 changes: 0 additions & 4 deletions packages/x-data-grid/src/tests/filterPanel.DataGrid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,6 @@ describe('<DataGrid /> - Filter panel', () => {
);
expect(screen.queryAllByRole('tooltip').length).to.deep.equal(1);

// TODO v6: remove the next two lines
deleteFilterForm();
expect(onFilterModelChange.lastCall.args[0].items[0].value).to.equal(undefined);

deleteFilterForm();
clock.tick(100);
expect(screen.queryAllByRole('tooltip').length).to.deep.equal(0);
Expand Down

0 comments on commit c0af84d

Please sign in to comment.