diff options
Diffstat (limited to 'src/hooks/useQuery.ts')
-rw-r--r-- | src/hooks/useQuery.ts | 4 |
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 }; |