diff --git a/components/filters/checkbox-filter.tsx b/components/filters/checkbox-filter.tsx index fa326b3..a385126 100644 --- a/components/filters/checkbox-filter.tsx +++ b/components/filters/checkbox-filter.tsx @@ -22,7 +22,8 @@ export const CheckboxFilter = ({ const handleValueChange = (value: boolean) => { const newValue = value ? [value.toString()] : []; onSelect(newValue); - const newUrl = createUrl(paramKey, newValue, pathname); + const currentPath = pathname === "/" ? "/explore/" : pathname; + const newUrl = createUrl(paramKey, newValue, currentPath); router.replace(newUrl, { scroll: false }); }; diff --git a/components/filters/select-filter.tsx b/components/filters/select-filter.tsx index 1f1e122..1417503 100644 --- a/components/filters/select-filter.tsx +++ b/components/filters/select-filter.tsx @@ -27,10 +27,11 @@ export const SelectFilter = ({ const handleSelectionChange = (selection: unknown) => { onSelect(Array.from(selection as Set)); + const currentPath = pathname === "/" ? "/explore/" : pathname; const newUrl = createUrl( placeholder, Array.from(selection as Set), - pathname, + currentPath, ); router.replace(newUrl, { scroll: false }); }; diff --git a/components/table/row.tsx b/components/table/row.tsx index 0ff962d..c7cc107 100644 --- a/components/table/row.tsx +++ b/components/table/row.tsx @@ -164,7 +164,8 @@ export const Labels = ({ const handleClick = (key: FilterKeys, values: string[]) => { updateFilter(key, values); - const newUrl = createUrl(key, values, pathname); + const currentPath = pathname === "/" ? "/explore/" : pathname; + const newUrl = createUrl(key, values, currentPath); router.replace(newUrl, { scroll: false }); };