summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hooks/useQuery.ts4
-rw-r--r--src/lib/ServiceFilters.tsx2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/hooks/useQuery.ts b/src/hooks/useQuery.ts
index e9a00ec..821dfe4 100644
--- a/src/hooks/useQuery.ts
+++ b/src/hooks/useQuery.ts
@@ -11,8 +11,8 @@ const useQuery = (): UseQuery => {
const query = Object.fromEntries(searchParams);
const setQuery = (newQuery: Record<string, string>): void => {
- const queryString = new URLSearchParams(newQuery);
- history.push({ search: `?${queryString}` });
+ const queryString = new URLSearchParams(newQuery).toString();
+ history.push({ search: queryString && `?${queryString}` });
};
return { query, setQuery };
diff --git a/src/lib/ServiceFilters.tsx b/src/lib/ServiceFilters.tsx
index b3cfae9..a2c645b 100644
--- a/src/lib/ServiceFilters.tsx
+++ b/src/lib/ServiceFilters.tsx
@@ -44,7 +44,7 @@ const ServiceFilters: React.FC = () => {
setQuery(updatedQuery);
};
- const resetFilters = () => history.push(service.route);
+ const resetFilters = () => setQuery({});
return (
<div className="mr-6 flex items-center">