From 8ea9d906c0d18dc0a6ccc5f13f1dca7c0ff12145 Mon Sep 17 00:00:00 2001 From: Andrey Nenashev Date: Thu, 18 Jan 2024 11:57:31 +0100 Subject: [PATCH] bugfix(fe): Search page freezing on loading state for tabs with 0 entities (#1587) --- odd-platform-ui/src/components/Search/Results/Results.tsx | 4 ++-- .../src/redux/selectors/dataentitySearch.selectors.ts | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/odd-platform-ui/src/components/Search/Results/Results.tsx b/odd-platform-ui/src/components/Search/Results/Results.tsx index 737158318..faa55b2ae 100644 --- a/odd-platform-ui/src/components/Search/Results/Results.tsx +++ b/odd-platform-ui/src/components/Search/Results/Results.tsx @@ -51,7 +51,7 @@ const Results: React.FC = () => { const searchResults = useAppSelector(getSearchResults); const searchResultsError = useAppSelector(getSearchResultsError); const searchFiltersSynced = useAppSelector(getSearchFacetsSynced); - const { total, page, hasNext } = useAppSelector(getSearchResultsPageInfo); + const { page, hasNext } = useAppSelector(getSearchResultsPageInfo); const isSearchFetching = useAppSelector(getSearchIsFetching); const isSearchCreatingAndFetching = useAppSelector(getSearchIsCreatingAndFetching); @@ -160,7 +160,7 @@ const Results: React.FC = () => { diff --git a/odd-platform-ui/src/redux/selectors/dataentitySearch.selectors.ts b/odd-platform-ui/src/redux/selectors/dataentitySearch.selectors.ts index f594f84b1..ec39a37d4 100644 --- a/odd-platform-ui/src/redux/selectors/dataentitySearch.selectors.ts +++ b/odd-platform-ui/src/redux/selectors/dataentitySearch.selectors.ts @@ -68,23 +68,19 @@ export const getSearchIsFetching = createSelector( getSearchUpdateStatuses, getSearchResultsFetchStatuses, getSearchFacetsSynced, - searchState, ( { isLoading: isSearchCreating }, { isLoading: isSearchFetching }, { isLoading: isSearchUpdating }, { isLoading: isSearchResultsFetching }, - isSynced, - search + isSynced ) => compact([ isSearchCreating, isSearchFetching, isSearchUpdating, isSearchResultsFetching, - ]).length > 0 || - !isSynced || - (!!search.results.pageInfo.total && !search.results.items.length) + ]).length > 0 || !isSynced ); export const getSearchIsCreatingAndFetching = createSelector(