Update UpgradeOverlay.tsx

This commit is contained in:
Daniel Hougaard
2024-02-22 06:29:27 +01:00
parent 4553c6bb37
commit 52cfa1ba39
@@ -10,9 +10,12 @@ export const UpgradeOverlay = () => {
const router = useRouter(); const router = useRouter();
const { currentWorkspace } = useWorkspace(); const { currentWorkspace } = useWorkspace();
const [isUpgrading, setIsUpgrading] = useToggle(false); const [isUpgrading, setIsUpgrading] = useToggle(false);
const isProjectRoute = router.pathname.includes("/project");
const { isLoading: isUpgradeStatusLoading } = useGetUpgradeProjectStatus({ const { isLoading: isUpgradeStatusLoading } = useGetUpgradeProjectStatus({
projectId: currentWorkspace?.id ?? "", projectId: currentWorkspace?.id ?? "",
enabled: currentWorkspace?.version === ProjectVersion.V1, enabled: isProjectRoute && currentWorkspace && currentWorkspace.version === ProjectVersion.V1,
refetchInterval: 5_000, refetchInterval: 5_000,
onSuccess: (data) => { onSuccess: (data) => {
if (!data) return; if (!data) return;
@@ -26,7 +29,7 @@ export const UpgradeOverlay = () => {
}); });
// make sure only to display this on /project routes // make sure only to display this on /project routes
if (!currentWorkspace || !router.pathname.includes("/project")) { if (!currentWorkspace || !isProjectRoute) {
return null; return null;
} }