Skip to content

Commit

Permalink
fix: improve projectName column sorting behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
atrincas authored and agnlez committed Jan 14, 2025
1 parent d181f8e commit 5a956a4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/src/containers/overview/table/view/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,16 @@ export function OverviewTable() {
const handleSortingChange = (updater: Updater<SortingState>) => {
const newSorting =
typeof updater === "function" ? updater(sorting) : updater;
setSorting(newSorting.length === 0 ? DEFAULT_SORTING : newSorting);

// We want to toggle projectName between asc/desc only (other columns can be asc/desc/none)
if (
newSorting.length === 0 &&
sorting.some((s) => s.id === "projectName")
) {
setSorting([{ id: "projectName", desc: false }]);
} else {
setSorting(newSorting.length === 0 ? DEFAULT_SORTING : newSorting);
}
};
const [pagination, setPagination] = useState<PaginationState>({
pageIndex: 0,
Expand Down

0 comments on commit 5a956a4

Please sign in to comment.