diff --git a/app/components/SortableTable.tsx b/app/components/SortableTable.tsx index 340268e34d..d56796acf9 100644 --- a/app/components/SortableTable.tsx +++ b/app/components/SortableTable.tsx @@ -1,7 +1,6 @@ import type { ColumnSort } from "@tanstack/react-table"; import { useCallback } from "react"; -import { useHistory, useLocation } from "react-router-dom"; -import useQuery from "~/hooks/useQuery"; +import { useHistory } from "react-router-dom"; import lazyWithRetry from "~/utils/lazyWithRetry"; import type { Props as TableProps } from "./Table"; @@ -10,21 +9,21 @@ const Table = lazyWithRetry(() => import("~/components/Table")); export type Props = Omit, "onChangeSort">; export function SortableTable(props: Props) { - const location = useLocation(); const history = useHistory(); - const params = useQuery(); const handleChangeSort = useCallback( (sort: ColumnSort) => { + const { pathname, search } = history.location; + const params = new URLSearchParams(search); params.set("sort", sort.id); params.set("direction", sort.desc ? "desc" : "asc"); history.replace({ - pathname: location.pathname, + pathname, search: params.toString(), }); }, - [params, history, location.pathname] + [history] ); return ;