From 52cfa1ba398af1ef3436767151a4d093e32b1dec Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Thu, 22 Feb 2024 06:29:27 +0100 Subject: [PATCH] Update UpgradeOverlay.tsx --- .../src/components/v2/UpgradeOverlay/UpgradeOverlay.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/v2/UpgradeOverlay/UpgradeOverlay.tsx b/frontend/src/components/v2/UpgradeOverlay/UpgradeOverlay.tsx index aea5bb5826..7dd1f5afab 100644 --- a/frontend/src/components/v2/UpgradeOverlay/UpgradeOverlay.tsx +++ b/frontend/src/components/v2/UpgradeOverlay/UpgradeOverlay.tsx @@ -10,9 +10,12 @@ export const UpgradeOverlay = () => { const router = useRouter(); const { currentWorkspace } = useWorkspace(); const [isUpgrading, setIsUpgrading] = useToggle(false); + + const isProjectRoute = router.pathname.includes("/project"); + const { isLoading: isUpgradeStatusLoading } = useGetUpgradeProjectStatus({ projectId: currentWorkspace?.id ?? "", - enabled: currentWorkspace?.version === ProjectVersion.V1, + enabled: isProjectRoute && currentWorkspace && currentWorkspace.version === ProjectVersion.V1, refetchInterval: 5_000, onSuccess: (data) => { if (!data) return; @@ -26,7 +29,7 @@ export const UpgradeOverlay = () => { }); // make sure only to display this on /project routes - if (!currentWorkspace || !router.pathname.includes("/project")) { + if (!currentWorkspace || !isProjectRoute) { return null; }