From 78b2871be71c8af6fb53e08f90d663d800ec3d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Zi=C3=B3=C5=82ek?= Date: Wed, 16 Oct 2024 15:20:10 +0200 Subject: [PATCH] fix: ProjectSearch stuck on infinite loading --- client/src/views/ProjectsView/ProjectsView.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/src/views/ProjectsView/ProjectsView.tsx b/client/src/views/ProjectsView/ProjectsView.tsx index 39061d317c..f879b1e62a 100644 --- a/client/src/views/ProjectsView/ProjectsView.tsx +++ b/client/src/views/ProjectsView/ProjectsView.tsx @@ -73,6 +73,7 @@ const ProjectsView = (): ReactElement => { data: searchedProjects, refetch: refetchSearchedProjects, status: statusSearchedProjects, + isFetching: isFetchingSearchedProjects, } = useSearchedProjects(projectsSearchParameters); const { data: searchedProjectsDetails, @@ -80,6 +81,18 @@ const ProjectsView = (): ReactElement => { isFetching: isFetchingSearchedProjectsDetails, } = useSearchedProjectsDetails(searchedProjects); + useEffect(() => { + if ( + isProjectsSearchInProgress && + searchedProjects && + searchedProjects.length === 0 && + !isFetchingSearchedProjects + ) { + setIsProjectsSearchInProgress(false); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [searchedProjects, isFetchingSearchedProjects]); + useEffect(() => { if (isFetchingSearchedProjectsDetails) { return;