diff --git a/src/components/App/SideBar/FilterSearch/index.tsx b/src/components/App/SideBar/FilterSearch/index.tsx index 5fc914029..e212530c4 100644 --- a/src/components/App/SideBar/FilterSearch/index.tsx +++ b/src/components/App/SideBar/FilterSearch/index.tsx @@ -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' @@ -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(defaultValues.selectedTypes) const [hops, setHops] = useState(defaultValues.hops) const [sourceNodes, setSourceNodes] = useState(defaultValues.sourceNodes) @@ -83,8 +81,6 @@ export const FilterSearch = ({ anchorEl, setAnchorEl, onClose }: Props) => { setAnchorEl(null) onClose() - - await fetchData(setBudget, setAbortRequests) } return ( diff --git a/src/stores/useDataStore/index.ts b/src/stores/useDataStore/index.ts index 49102547c..518dacdb8 100644 --- a/src/stores/useDataStore/index.ts +++ b/src/stores/useDataStore/index.ts @@ -302,7 +302,10 @@ export const useDataStore = create()( fetchData() }, resetDataNew: () => null, - setFilters: (filters: FilterParams) => set((state) => ({ filters: { ...state.filters, ...filters, page: 0 } })), + setFilters: (filters: Partial) => { + 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 }),