From 448b6b10adc27d5bbc6ca4b72ac379e1236f9068 Mon Sep 17 00:00:00 2001 From: bosko-m <88723596+bosko-m@users.noreply.github.com> Date: Tue, 29 Jul 2025 16:54:53 +0200 Subject: [PATCH 1/2] Update dataActionsBar.tsx - empty list of GAs on back after idle time Signed-off-by: bosko-m <88723596+bosko-m@users.noreply.github.com> --- govtool/frontend/src/context/dataActionsBar.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/govtool/frontend/src/context/dataActionsBar.tsx b/govtool/frontend/src/context/dataActionsBar.tsx index 9ef913a26..2c7de5c5b 100644 --- a/govtool/frontend/src/context/dataActionsBar.tsx +++ b/govtool/frontend/src/context/dataActionsBar.tsx @@ -42,7 +42,7 @@ interface ProviderProps { } const DataActionsBarProvider: FC = ({ children }) => { - const isAdjusting = useRef(false); + const [isAdjusting, setIsAdjusting] = useState(false); const [searchText, setSearchText] = useState(""); const debouncedSearchText = useDebounce(searchText.trim(), 300); const [filtersOpen, setFiltersOpen] = useState(false); @@ -79,7 +79,11 @@ const DataActionsBarProvider: FC = ({ children }) => { pathname.includes("governance_actions/category"); useEffect(() => { - isAdjusting.current = true; + setIsAdjusting(true); + + const timeout = setTimeout(() => { + setIsAdjusting(false); + }, 150); // Adjust delay if needed if ( (!pathname.includes("drep_directory") && @@ -89,6 +93,8 @@ const DataActionsBarProvider: FC = ({ children }) => { ) { resetState(); } + + return () => clearTimeout(timeout); }, [pathname, resetState]); useEffect(() => { @@ -97,7 +103,7 @@ const DataActionsBarProvider: FC = ({ children }) => { const contextValue = useMemo( () => ({ - isAdjusting: isAdjusting.current, + isAdjusting, chosenFilters, chosenFiltersLength: chosenFilters.length, chosenSorting, From a56f5a55a8836c7ad2a3cd6b2a63f2d9417f8b7a Mon Sep 17 00:00:00 2001 From: bosko-m <88723596+bosko-m@users.noreply.github.com> Date: Tue, 29 Jul 2025 17:09:29 +0200 Subject: [PATCH 2/2] Update dataActionsBar.tsx - lint check fix Signed-off-by: bosko-m <88723596+bosko-m@users.noreply.github.com> --- govtool/frontend/src/context/dataActionsBar.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/govtool/frontend/src/context/dataActionsBar.tsx b/govtool/frontend/src/context/dataActionsBar.tsx index 2c7de5c5b..d596f5d2f 100644 --- a/govtool/frontend/src/context/dataActionsBar.tsx +++ b/govtool/frontend/src/context/dataActionsBar.tsx @@ -8,7 +8,6 @@ import React, { useEffect, useMemo, FC, - useRef, } from "react"; import { useLocation } from "react-router-dom"; @@ -65,7 +64,6 @@ const DataActionsBarProvider: FC = ({ children }) => { setSearchText(""); setChosenFilters([]); setChosenSorting(""); - isAdjusting.current = false; }, []); const userMovedToDifferentAppArea =