Allow monitor sort headers to reset to default
This commit is contained in:
1 parent
0cb48596a0
commit
380968472f
5 files changed
+26
-29
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
ColoredLabel,
|
||||
} from "@/Components/design-elements";
|
||||
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
|
||||
import { getNextMonitorSort } from "@/Utils/MonitorUtils";
|
||||
import { HistogramPageSpeed } from "@/Components/monitors";
|
||||
import { ArrowDown, ArrowUp } from "lucide-react";
|
||||
import type { Header } from "@/Components/design-elements/Table";
|
||||
@@ -81,13 +82,9 @@ export const PageSpeedMonitorsTable = ({
|
||||
const handleSort = (e: any, 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();
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user