From 409823c7e8df510623246d9816b67639b29fb6a6 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 1 Nov 2024 13:33:13 +0200 Subject: [PATCH] Fixed: Interactive searches when using Escape to close previous searches --- .../src/InteractiveSearch/InteractiveSearch.tsx | 16 ++++++++++------ .../Search/SeasonInteractiveSearchModal.tsx | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/frontend/src/InteractiveSearch/InteractiveSearch.tsx b/frontend/src/InteractiveSearch/InteractiveSearch.tsx index 6dd3c2f1f..9dff36198 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearch.tsx +++ b/frontend/src/InteractiveSearch/InteractiveSearch.tsx @@ -160,13 +160,17 @@ function InteractiveSearch({ type, searchPayload }: InteractiveSearchProps) { [dispatch] ); - useEffect(() => { - // Only fetch releases if they are not already being fetched and not yet populated. + useEffect( + () => { + // Only fetch releases if they are not already being fetched and not yet populated. - if (!isFetching && !isPopulated) { - dispatch(fetchReleases(searchPayload)); - } - }, [isFetching, isPopulated, searchPayload, dispatch]); + if (!isFetching && !isPopulated) { + dispatch(fetchReleases(searchPayload)); + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [] + ); const errorMessage = getErrorMessage(error); diff --git a/frontend/src/Series/Search/SeasonInteractiveSearchModal.tsx b/frontend/src/Series/Search/SeasonInteractiveSearchModal.tsx index babe59469..bc2a5b753 100644 --- a/frontend/src/Series/Search/SeasonInteractiveSearchModal.tsx +++ b/frontend/src/Series/Search/SeasonInteractiveSearchModal.tsx @@ -23,10 +23,10 @@ function SeasonInteractiveSearchModal( const dispatch = useDispatch(); const handleModalClose = useCallback(() => { + onModalClose(); + dispatch(cancelFetchReleases()); dispatch(clearReleases()); - - onModalClose(); }, [dispatch, onModalClose]); useEffect(() => {