diff --git a/src/components/DicomTagBrowser/DicomTagBrowser.tsx b/src/components/DicomTagBrowser/DicomTagBrowser.tsx index ede592c..abcb31f 100644 --- a/src/components/DicomTagBrowser/DicomTagBrowser.tsx +++ b/src/components/DicomTagBrowser/DicomTagBrowser.tsx @@ -50,7 +50,12 @@ const DicomTagBrowser = ({ clients, studyInstanceUID }: DicomTagBrowserProps): J const debouncedSearchValue = useDebounce(searchInput, 300) useEffect(() => { - setFilterValue(debouncedSearchValue) + if (debouncedSearchValue === '') { + setFilterValue('') + setExpandedKeys([]) + } else { + setFilterValue(debouncedSearchValue) + } }, [debouncedSearchValue]) useEffect(() => { @@ -229,11 +234,6 @@ const DicomTagBrowser = ({ clients, studyInstanceUID }: DicomTagBrowserProps): J return transformTagsToTableData(tags) }, [instanceNumber, selectedDisplaySetInstanceUID, displaySets]) - // Reset expanded keys when search value changes - useEffect(() => { - setExpandedKeys([]) - }, [filterValue]) - const filteredData = useMemo(() => { if (filterValue === undefined || filterValue === '') return tableData