Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hassanad94 committed Nov 16, 2023
1 parent eee2b6d commit fbdc01a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 6 additions & 2 deletions apps/sensenet/src/components/search/filters/type-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ type moreOptionsItem = {
}

export const TypeFilter = () => {
const ac = new AbortController()
const repo = useRepository()
const classes = useStyles()
const localization = useLocalization().search.filters.type
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null)
const searchState = useSearch()
const [otherContentTypes, setOtherContentTypes] = useState<moreOptionsItem[]>([])
const categoryField = repo.schemas.getFieldTypeByName('Categories')

useEffect(() => {
const ac = new AbortController()
const categoryField = repo.schemas.getFieldTypeByName('Categories')
const fetchData = async () => {
try {
if (categoryField) {
Expand All @@ -118,6 +118,10 @@ export const TypeFilter = () => {
}
}
fetchData()

return () => {
ac.abort()
}
}, [repo])

const [[activeFromMore], othersFromMore] = otherContentTypes.reduce(
Expand Down
16 changes: 7 additions & 9 deletions apps/sensenet/src/components/search/search-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ export const SearchBar = () => {
className={classes.inputButton}
aria-label={localization.clearTerm}
title={localization.clearTerm}
onClick={() => null}>
<Cancel
onClick={() => {
if (searchInputRef.current) {
searchInputRef.current.value = ''
}
searchState.setTerm('')
}}
/>
onClick={() => {
if (searchInputRef.current) {
searchInputRef.current.value = ''
}
searchState.setTerm('')
}}>
<Cancel />
</IconButton>
)}
<IconButton
Expand Down

0 comments on commit fbdc01a

Please sign in to comment.