From b37058d0e2c226eef56aceb3e9b1e57d715a68a9 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 7 May 2025 11:30:31 +0530 Subject: [PATCH] feat: switched to is fetching --- .../admin/OverviewPage/components/CachingPanel.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx b/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx index 39fb0e9f7..170a85c0d 100644 --- a/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx +++ b/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx @@ -19,10 +19,10 @@ export const CachingPanel = () => { const { data: invalidationStatus, - isPending, + isFetching, refetch } = useGetInvalidatingCacheStatus(shouldPoll); - const isInvalidating = Boolean(shouldPoll && !isPending && invalidationStatus); + const isInvalidating = Boolean(shouldPoll && (isFetching || invalidationStatus)); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "invalidateCache" @@ -34,13 +34,8 @@ export const CachingPanel = () => { try { await invalidateCache({ type }); createNotification({ text: `Began invalidating ${type} cache`, type: "success" }); + setShouldPoll(true); handlePopUpClose("invalidateCache"); - - refetch().then((v) => - v - ? setShouldPoll(true) - : createNotification({ text: "Successfully invalidated cache", type: "success" }) - ); } catch (err) { console.error(err); createNotification({ text: `Failed to invalidate ${type} cache`, type: "error" });