From 6a30fca6bcecb3b5e7db6a7f0a8d0588350cc960 Mon Sep 17 00:00:00 2001 From: Miro Date: Tue, 12 Aug 2025 10:32:14 +0200 Subject: [PATCH 1/2] Fix for 4021, Missing Loader while typing/pasting into the search bar --- .../frontend/src/hooks/queries/useGetProposalsQuery.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts b/govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts index bee3cd39d..a21b7b986 100644 --- a/govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts +++ b/govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts @@ -33,7 +33,7 @@ export const useGetProposalsQuery = ({ return allProposals.flatMap((proposal) => proposal.elements); }; - const { data, isLoading } = useQuery( + const { data, isLoading, isFetching } = useQuery( [ QUERY_KEYS.useGetProposalsKey, filters, @@ -46,16 +46,18 @@ export const useGetProposalsQuery = ({ fetchProposals, { enabled, - refetchOnWindowFocus: true, + refetchOnWindowFocus: false, + refetchOnReconnect: false, keepPreviousData: true, - cacheTime: Infinity, }, ); + const isProposalsLoading = isLoading || isFetching; + const proposals = Object.values(groupByType(data) ?? []); return { - isProposalsLoading: isLoading, + isProposalsLoading, proposals, }; }; From 4c3901f22e1848aed3b7a422ca5f7058f961cf37 Mon Sep 17 00:00:00 2001 From: Adam Tomaszczyk Date: Tue, 12 Aug 2025 13:06:22 +0200 Subject: [PATCH 2/2] Search stops working after entering GA details and going back to Live Voting #4020 --- .../frontend/src/context/dataActionsBar.tsx | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/govtool/frontend/src/context/dataActionsBar.tsx b/govtool/frontend/src/context/dataActionsBar.tsx index 9ef913a26..e2776346c 100644 --- a/govtool/frontend/src/context/dataActionsBar.tsx +++ b/govtool/frontend/src/context/dataActionsBar.tsx @@ -68,18 +68,32 @@ const DataActionsBarProvider: FC = ({ children }) => { isAdjusting.current = false; }, []); + const gADetailsPathnameRegexp = /^.*\/governance_actions\/[a-fA-F0-9]{64}$/; const userMovedToDifferentAppArea = pathname !== lastPath && (!pathname.startsWith(lastPath) || lastPath === "" || lastPath === "/"); + const userOpenedGADetails = gADetailsPathnameRegexp.test(pathname); const userOpenedGADetailsFromCategoryPage = - lastPath.includes("governance_actions/category") && - pathname.includes("governance_actions/"); + userOpenedGADetails && + lastPath.includes("governance_actions/category"); const userMovedFromGAListToCategoryPage = lastPath.endsWith("governance_actions") && pathname.includes("governance_actions/category"); + const userMovedFromGADetailsToListOrCategoryPage = + (gADetailsPathnameRegexp.test(lastPath) && + pathname.includes("governance_actions")) || + pathname.includes("governance_actions/category"); useEffect(() => { isAdjusting.current = true; + if (userOpenedGADetails) { + return; + } + + if (userMovedFromGADetailsToListOrCategoryPage && debouncedSearchText.length > 0) { + isAdjusting.current = false; + return; + } if ( (!pathname.includes("drep_directory") && @@ -93,7 +107,7 @@ const DataActionsBarProvider: FC = ({ children }) => { useEffect(() => { setLastPath(pathname); - }, [searchText, chosenFilters, chosenSorting]); + }, [pathname, searchText, chosenFilters, chosenSorting]); const contextValue = useMemo( () => ({