From d24463f2d1ed99bb0df1448501fd94ab20353f5e Mon Sep 17 00:00:00 2001 From: Tony Vi Date: Wed, 31 May 2023 15:51:49 +0300 Subject: [PATCH] fix(useUrlFilterParams): reset preset w/o empty param, #804 --- src/hooks/useUrlFilterParams.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hooks/useUrlFilterParams.ts b/src/hooks/useUrlFilterParams.ts index 816f214b1..7b25c82f3 100644 --- a/src/hooks/useUrlFilterParams.ts +++ b/src/hooks/useUrlFilterParams.ts @@ -180,9 +180,11 @@ export const useUrlFilterParams = ({ preset }: { preset?: FilterById }) => { (filter: string | undefined | null) => { router.push({ pathname: router.asPath.split('?')[0], - query: { - filter, - }, + query: filter + ? { + filter, + } + : {}, }); }, [router],