@@ -16,6 +16,7 @@ import { getPropertyFilterOptions } from '../helpers';
1616
1717type Args = {
1818 gpus : IGpu [ ] ;
19+ withSearchParams ?: boolean ;
1920} ;
2021
2122type RequestParamsKeys = 'project_name' | 'gpu_name' | 'gpu_count' | 'gpu_memory' | 'backend' | 'spot_policy' | 'group_by' ;
@@ -52,7 +53,7 @@ const defaultGroupByOptions = [{ ...gpuFilterOption }, { label: 'Backend', value
5253
5354const groupByRequestParamName : RequestParamsKeys = 'group_by' ;
5455
55- export const useFilters = ( { gpus } : Args ) => {
56+ export const useFilters = ( { gpus, withSearchParams = true } : Args ) => {
5657 const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
5758 const { projectOptions } = useProjectFilter ( { localStorePrefix : 'offers-list-projects' } ) ;
5859 const projectNameIsChecked = useRef ( false ) ;
@@ -75,7 +76,9 @@ export const useFilters = ({ gpus }: Args) => {
7576 } ) ;
7677
7778 const clearFilter = ( ) => {
78- setSearchParams ( { } ) ;
79+ if ( withSearchParams ) {
80+ setSearchParams ( { } ) ;
81+ }
7982 setPropertyFilterQuery ( EMPTY_QUERY ) ;
8083 setGroupBy ( [ ] ) ;
8184 } ;
@@ -137,6 +140,10 @@ export const useFilters = ({ gpus }: Args) => {
137140 tokens : PropertyFilterProps . Query [ 'tokens' ] ;
138141 groupBy : MultiselectProps . Options ;
139142 } ) => {
143+ if ( ! withSearchParams ) {
144+ return ;
145+ }
146+
140147 const searchParams = tokensToSearchParams < RequestParamsKeys > ( tokens ) ;
141148
142149 groupBy . forEach ( ( { value } ) => searchParams . append ( groupByRequestParamName , value as string ) ) ;
0 commit comments