From e18bb7d5bc57515f57f0b3888c21f5f522109073 Mon Sep 17 00:00:00 2001 From: Vikrant Gupta <54737045+Vikrant2520@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:49:22 +0530 Subject: [PATCH] fix: [3958]: restrict dashboard api call on other pages (#4066) --- frontend/src/providers/Dashboard/Dashboard.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx index c5678c18f0..d9d3b8bdc3 100644 --- a/frontend/src/providers/Dashboard/Dashboard.tsx +++ b/frontend/src/providers/Dashboard/Dashboard.tsx @@ -185,7 +185,12 @@ export function DashboardProvider({ ); useEffect(() => { - if (isVisible && updatedTimeRef.current) { + // make the call on tab visibility only if the user is on dashboard / widget page + if ( + isVisible && + updatedTimeRef.current && + (!!isDashboardPage || !!isDashboardWidgetPage) + ) { dashboardResponse.refetch(); } // eslint-disable-next-line react-hooks/exhaustive-deps