diff --git a/src/components/App/SideBar/FilterSearch/__tests__/index.tsx b/src/components/App/SideBar/FilterSearch/__tests__/index.tsx index ef73ba5a7..c09d6a4c2 100644 --- a/src/components/App/SideBar/FilterSearch/__tests__/index.tsx +++ b/src/components/App/SideBar/FilterSearch/__tests__/index.tsx @@ -18,6 +18,7 @@ const mockSetShowAllSchemas = jest.fn() const mockSetAnchorEl = jest.fn() const mockFetchData = jest.fn() const mockSetAbortRequests = jest.fn() +const mockOnClose = jest.fn() const mockSchemaAll = [{ type: 'Type1' }, { type: 'Type2' }, { type: 'Type3' }, { type: 'Type4' }, { type: 'Type5' }] @@ -28,6 +29,7 @@ describe('FilterSearch Component', () => { setFilters: mockSetFilters, fetchData: mockFetchData, setAbortRequests: mockSetAbortRequests, + onClose: mockOnClose, }) }) @@ -37,6 +39,7 @@ describe('FilterSearch Component', () => { { void + onClose: () => void } const defaultValues = { @@ -27,7 +28,14 @@ const defaultValues = { maxResults: 30, } -export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anchorEl, setAnchorEl }: Props) => { +export const FilterSearch = ({ + showAllSchemas, + setShowAllSchemas, + schemaAll, + anchorEl, + setAnchorEl, + onClose, +}: Props) => { const handleSchemaTypeClick = (type: string) => { setSelectedTypes((prevSelectedTypes) => prevSelectedTypes.includes(type) ? prevSelectedTypes.filter((t) => t !== type) : [...prevSelectedTypes, type], @@ -65,6 +73,7 @@ export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anc }) setAnchorEl(null) + onClose() await fetchData(setBudget, setAbortRequests) } diff --git a/src/components/App/SideBar/RegularView/index.tsx b/src/components/App/SideBar/RegularView/index.tsx index 3cb54dadc..e4c2fe061 100644 --- a/src/components/App/SideBar/RegularView/index.tsx +++ b/src/components/App/SideBar/RegularView/index.tsx @@ -92,6 +92,11 @@ export const RegularView = () => { setShowAllSchemas(false) } + const handleCloseFilterSearch = () => { + setIsFilterOpen(false) + setAnchorEl(null) + } + const navigate = useNavigate() return ( @@ -136,6 +141,7 @@ export const RegularView = () => {