Skip to content

Commit

Permalink
fix: do not open filter panel automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
dziraf committed Jan 23, 2024
1 parent f5cd4b6 commit 7b73063
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
8 changes: 1 addition & 7 deletions src/frontend/hooks/use-filter-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ export const useFilterDrawer = () => {
const dispatch = useDispatch()
const isVisible = useSelector((state: ReduxState) => state.filterDrawer.isVisible)

const { showFilters, filters = {} } = useQueryParams()
const { filters = {} } = useQueryParams()

useEffect(() => {
setFiltersCount(Object.keys(filters).length)
}, [filters])

useEffect(() => {
if (showFilters) {
dispatch(showFilterDrawer())
}
}, [showFilters])

const toggleFilter = () => {
dispatch(isVisible ? hideFilterDrawer() : showFilterDrawer())
}
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/hooks/use-query-params.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable no-unused-vars */
import isEmpty from 'lodash/isEmpty.js'
import pick from 'lodash/pick.js'
import { parse, stringify } from 'qs'
import { useMemo } from 'react'
Expand Down Expand Up @@ -45,7 +44,6 @@ export function useQueryParams<
[searchParams, pathname],
)
const { sortBy, direction, page, tab, filters, redirectUrl } = parsedQuery
const showFilters = !isEmpty(filters)
const listParams = useMemo(
() => pick(parsedQuery, [
QueryListParams.SortBy,
Expand Down Expand Up @@ -86,7 +84,6 @@ export function useQueryParams<
}

return {
showFilters,
parsedQuery,
listParams,
filters: filters as unknown as FiltersT,
Expand Down

0 comments on commit 7b73063

Please sign in to comment.