summaryrefslogtreecommitdiff
path: root/src/hooks/useQuery.ts
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-04-24 19:03:35 +0300
committereug-vs <eug-vs@keemail.me>2021-04-24 19:18:11 +0300
commitea5c69e11b2758df28f881f9110ca5d4a5d41211 (patch)
tree7ed745d892ddffdb83301819cc84d1b8f7aa9a19 /src/hooks/useQuery.ts
parentaa04c35e73ddd1f2d38de68e437c0c3d697d42e2 (diff)
downloadcommercel-ui-ea5c69e11b2758df28f881f9110ca5d4a5d41211.tar.gz
fix: reset filters correctly
Diffstat (limited to 'src/hooks/useQuery.ts')
-rw-r--r--src/hooks/useQuery.ts4
1 files changed, 2 insertions, 2 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 };