Allow monitor sort headers to reset to default

This commit is contained in:
fabiangigler committed 2026-09-23 13:35:01 +02:00
1 parent 0cb48596a0
commit 380968472f
5 files changed
+26 -29

No files matched your search

@@ -25,7 +25,7 @@ import type { RootState } from "@/Types/state";
import { Checkbox } from "@/Components/inputs";
import type { Tag } from "@/Types/Tag";
import { SPACING } from "@/Utils/Theme/constants";
import { getUptimePercentageColor } from "@/Utils/MonitorUtils";
import { getNextMonitorSort, getUptimePercentageColor } from "@/Utils/MonitorUtils";
import { formatPercentage } from "@/Utils/FormatUtils";
interface MonitorTableProps {
@@ -91,13 +91,9 @@ export const MonitorTable = ({
const handleSort = (e: React.MouseEvent, field: string) => {
e.preventDefault();
e.stopPropagation();
if (sortField === field) {
const newOrder = sortOrder === "asc" ? "desc" : "asc";
setSortOrder(newOrder);
} else {
setSortField(field);
setSortOrder("asc");
}
const nextSort = getNextMonitorSort(field, sortField, sortOrder);
setSortField(nextSort.field);
setSortOrder(nextSort.order);
refetch();
};