Skip to content

Commit

Permalink
Clean search
Browse files Browse the repository at this point in the history
  • Loading branch information
igoroctaviano committed Nov 21, 2024
1 parent b328b94 commit 210c290
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/DicomTagBrowser/DicomTagBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 210c290

Please sign in to comment.