From 032665404230dabc263e60e4e1289bc19c7b8c5d Mon Sep 17 00:00:00 2001 From: Siarhei Karol Date: Mon, 16 Dec 2024 17:08:31 +0300 Subject: [PATCH 1/2] reduce debounce timeout and show status message --- src/common/hooks/useFetchSearchData.ts | 3 +-- src/components/EditSection/EditSection.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/common/hooks/useFetchSearchData.ts b/src/common/hooks/useFetchSearchData.ts index 7f0712a2..dede8f9b 100644 --- a/src/common/hooks/useFetchSearchData.ts +++ b/src/common/hooks/useFetchSearchData.ts @@ -25,7 +25,7 @@ export const useFetchSearchData = () => { } = useSearchContext(); const { setIsLoading } = useLoadingState(); const { setMessage, data, setData, resetData, setPageMetadata } = useSearchState(); - const { addStatusMessagesItem, resetStatusMessages } = useStatusState(); + const { addStatusMessagesItem } = useStatusState(); const validateAndNormalizeQuery = useCallback( (type: SearchIdentifiers, query: string) => { @@ -133,7 +133,6 @@ export const useFetchSearchData = () => { selectedSegment, baseQuerySelector = SearchableIndexQuerySelector.Query, }: FetchDataParams) => { - resetStatusMessages(); const selectedNavigationSegment = selectedSegment ?? navigationSegment?.value; data && resetData(); diff --git a/src/components/EditSection/EditSection.tsx b/src/components/EditSection/EditSection.tsx index c815fb86..9ce64965 100644 --- a/src/components/EditSection/EditSection.tsx +++ b/src/components/EditSection/EditSection.tsx @@ -14,7 +14,7 @@ import { useInputsState, useProfileState, useStatusState, useUIState } from '@sr import { renderDrawComponent } from './renderDrawComponent'; import './EditSection.scss'; -const USER_INPUT_DELAY = 750; +const USER_INPUT_DELAY = 100; export const EditSection = memo(() => { const { selectedEntriesService } = useServicesContext() as Required; From 651cc94822041f399667dd0bd4e88c7a0f5af40f Mon Sep 17 00:00:00 2001 From: Siarhei Karol Date: Mon, 16 Dec 2024 17:37:18 +0300 Subject: [PATCH 2/2] clear search message --- src/common/hooks/useFetchSearchData.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/hooks/useFetchSearchData.ts b/src/common/hooks/useFetchSearchData.ts index dede8f9b..157fe0b9 100644 --- a/src/common/hooks/useFetchSearchData.ts +++ b/src/common/hooks/useFetchSearchData.ts @@ -24,7 +24,7 @@ export const useFetchSearchData = () => { precedingRecordsCount, } = useSearchContext(); const { setIsLoading } = useLoadingState(); - const { setMessage, data, setData, resetData, setPageMetadata } = useSearchState(); + const { setMessage, resetMessage, data, setData, resetData, setPageMetadata } = useSearchState(); const { addStatusMessagesItem } = useStatusState(); const validateAndNormalizeQuery = useCallback( @@ -175,6 +175,7 @@ export const useFetchSearchData = () => { setData(content); setPageMetadata({ totalPages, totalElements: totalRecords, prev, next }); + resetMessage(); } catch { addStatusMessagesItem?.(UserNotificationFactory.createMessage(StatusType.error, 'ld.errorFetching')); } finally {