From fbdc01a7605d8d16df7b3ca85aae72dc91e11b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81d=C3=A1m=20Hassan?= Date: Thu, 16 Nov 2023 14:46:34 +0100 Subject: [PATCH] some fixes --- .../components/search/filters/type-filter.tsx | 8 ++++++-- .../src/components/search/search-bar.tsx | 16 +++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/sensenet/src/components/search/filters/type-filter.tsx b/apps/sensenet/src/components/search/filters/type-filter.tsx index 3faff2c91..7d0bf48b8 100644 --- a/apps/sensenet/src/components/search/filters/type-filter.tsx +++ b/apps/sensenet/src/components/search/filters/type-filter.tsx @@ -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(null) const searchState = useSearch() const [otherContentTypes, setOtherContentTypes] = useState([]) - const categoryField = repo.schemas.getFieldTypeByName('Categories') useEffect(() => { + const ac = new AbortController() + const categoryField = repo.schemas.getFieldTypeByName('Categories') const fetchData = async () => { try { if (categoryField) { @@ -118,6 +118,10 @@ export const TypeFilter = () => { } } fetchData() + + return () => { + ac.abort() + } }, [repo]) const [[activeFromMore], othersFromMore] = otherContentTypes.reduce( diff --git a/apps/sensenet/src/components/search/search-bar.tsx b/apps/sensenet/src/components/search/search-bar.tsx index da96b2dba..d84b38a32 100644 --- a/apps/sensenet/src/components/search/search-bar.tsx +++ b/apps/sensenet/src/components/search/search-bar.tsx @@ -59,15 +59,13 @@ export const SearchBar = () => { className={classes.inputButton} aria-label={localization.clearTerm} title={localization.clearTerm} - onClick={() => null}> - { - if (searchInputRef.current) { - searchInputRef.current.value = '' - } - searchState.setTerm('') - }} - /> + onClick={() => { + if (searchInputRef.current) { + searchInputRef.current.value = '' + } + searchState.setTerm('') + }}> + )}