From adc481221e9af0bdd54565ed2a7ac23b502f5273 Mon Sep 17 00:00:00 2001 From: Sophie Turner Date: Wed, 31 Jul 2024 20:15:02 +0500 Subject: [PATCH] fix(search-filter): filter search modal should close automatically --- src/components/App/SideBar/FilterSearch/index.tsx | 5 ++++- src/components/App/SideBar/index.tsx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/App/SideBar/FilterSearch/index.tsx b/src/components/App/SideBar/FilterSearch/index.tsx index 7d9a726bf..0bf5b9a48 100644 --- a/src/components/App/SideBar/FilterSearch/index.tsx +++ b/src/components/App/SideBar/FilterSearch/index.tsx @@ -16,9 +16,10 @@ type Props = { setShowAllSchemas: (value: boolean) => void schemaAll: SchemaExtended[] anchorEl: HTMLElement | null + setAnchorEl: (value: HTMLElement | null) => void } -export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anchorEl }: Props) => { +export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anchorEl, setAnchorEl }: Props) => { const handleSchemaTypeClick = (type: string) => { setSelectedTypes((prevSelectedTypes) => prevSelectedTypes.includes(type) ? prevSelectedTypes.filter((t) => t !== type) : [...prevSelectedTypes, type], @@ -46,6 +47,8 @@ export const FilterSearch = ({ showAllSchemas, setShowAllSchemas, schemaAll, anc depth: hops.toString(), top_node_count: sourceNodes.toString(), }) + + setAnchorEl(null) } return ( diff --git a/src/components/App/SideBar/index.tsx b/src/components/App/SideBar/index.tsx index 53a0cc19a..3abdb530b 100644 --- a/src/components/App/SideBar/index.tsx +++ b/src/components/App/SideBar/index.tsx @@ -159,6 +159,7 @@ const Content = forwardRef(({ subViewOpen }, ref) =