Skip to content

Commit

Permalink
Merge pull request #2211 from MirzaHanan/Connect-Search-Filter
Browse files Browse the repository at this point in the history
Fixed(Search-Filter): Connect Search Filter and endpoint request
  • Loading branch information
Rassl authored Oct 18, 2024
2 parents f52726d + aaec478 commit b914f69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/components/App/SideBar/FilterSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getSchemaAll } from '~/network/fetchSourcesData'
import { useDataStore } from '~/stores/useDataStore'
import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore'
import { useSchemaStore } from '~/stores/useSchemaStore'
import { useUserStore } from '~/stores/useUserStore'
import { colors } from '~/utils/colors'
import { FastFilters } from './FastFilters'
import { Hops } from './Hops'
Expand All @@ -30,8 +29,7 @@ const defaultValues = {

export const FilterSearch = ({ anchorEl, setAnchorEl, onClose }: Props) => {
const [schemaAll, setSchemaAll] = useSchemaStore((s) => [s.schemas, s.setSchemas])
const { setFilters, fetchData, setAbortRequests } = useDataStore((s) => s)
const { setBudget } = useUserStore((s) => s)
const { setFilters } = useDataStore((s) => s)
const [selectedTypes, setSelectedTypes] = useState<string[]>(defaultValues.selectedTypes)
const [hops, setHops] = useState(defaultValues.hops)
const [sourceNodes, setSourceNodes] = useState<number>(defaultValues.sourceNodes)
Expand Down Expand Up @@ -83,8 +81,6 @@ export const FilterSearch = ({ anchorEl, setAnchorEl, onClose }: Props) => {

setAnchorEl(null)
onClose()

await fetchData(setBudget, setAbortRequests)
}

return (
Expand Down
5 changes: 4 additions & 1 deletion src/stores/useDataStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ export const useDataStore = create<DataStore>()(
fetchData()
},
resetDataNew: () => null,
setFilters: (filters: FilterParams) => set((state) => ({ filters: { ...state.filters, ...filters, page: 0 } })),
setFilters: (filters: Partial<FilterParams>) => {
set((state) => ({ filters: { ...state.filters, ...filters, skip: 0 } }))
get().fetchData(get().setBudget, get().setAbortRequests)
},
setSidebarFilterCounts: (sidebarFilterCounts) => set({ sidebarFilterCounts }),
setTrendingTopics: (trendingTopics) => set({ trendingTopics }),
setStats: (stats) => set({ stats }),
Expand Down

0 comments on commit b914f69

Please sign in to comment.