Skip to content

Commit

Permalink
Don't break the default sorting passed to the DataGridHeaderCell
Browse files Browse the repository at this point in the history
  • Loading branch information
Luwangel committed Aug 10, 2020
1 parent d747b15 commit d635a3f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/ra-ui-materialui/src/list/Datagrid.tsx
Expand Up @@ -101,13 +101,15 @@ const Datagrid: FC<DatagridProps> = props => {
event.stopPropagation();
const newField = event.currentTarget.dataset.field;
const newOrder =
currentSort.field === newField &&
event.currentTarget.dataset.order === 'ASC'
? 'DESC'
: 'ASC';
currentSort.field === newField
? currentSort.order === 'ASC'
? 'DESC'
: 'ASC'
: event.currentTarget.dataset.order;

setSort(newField, newOrder);
},
[currentSort.field, setSort]
[currentSort.field, currentSort.order, setSort]
);

const handleSelectAll = useCallback(
Expand Down

0 comments on commit d635a3f

Please sign in to comment.