diff --git a/apps/studio/components/interfaces/Support/SupportFormV2.tsx b/apps/studio/components/interfaces/Support/SupportFormV2.tsx index 91959f7be6e..8e317bdb2c4 100644 --- a/apps/studio/components/interfaces/Support/SupportFormV2.tsx +++ b/apps/studio/components/interfaces/Support/SupportFormV2.tsx @@ -82,9 +82,7 @@ export const SupportFormV2 = ({ form, initialError, state, dispatch }: SupportFo const sanitizedLogSnapshot = useConstant(getSanitizedBreadcrumbs) - const { data: commit } = useDeploymentCommitQuery({ - staleTime: 1000 * 60 * 10, // 10 minutes - }) + const { data: commit } = useDeploymentCommitQuery() const { mutate: submitSupportTicket } = useSendSupportTicketMutation({ onSuccess: (_, variables) => { diff --git a/apps/studio/data/utils/deployment-commit-query.ts b/apps/studio/data/utils/deployment-commit-query.ts index f434268ac26..1e1dede03c2 100644 --- a/apps/studio/data/utils/deployment-commit-query.ts +++ b/apps/studio/data/utils/deployment-commit-query.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query' import { fetchHandler } from 'data/fetchers' -import { BASE_PATH } from 'lib/constants' +import { BASE_PATH, IS_PLATFORM } from 'lib/constants' import type { ResponseError, UseCustomQueryOptions } from 'types' export async function getDeploymentCommit(signal?: AbortSignal) { @@ -17,5 +17,7 @@ export const useDeploymentCommitQuery = ({ useQuery({ queryKey: ['deployment-commit'], queryFn: ({ signal }) => getDeploymentCommit(signal), + enabled: IS_PLATFORM && enabled, + staleTime: 1000 * 60 * 10, // 10 minutes ...options, }) diff --git a/apps/studio/hooks/use-check-latest-deploy.tsx b/apps/studio/hooks/use-check-latest-deploy.tsx index 8cbbae1a84c..96719777049 100644 --- a/apps/studio/hooks/use-check-latest-deploy.tsx +++ b/apps/studio/hooks/use-check-latest-deploy.tsx @@ -3,9 +3,9 @@ import { useRouter } from 'next/router' import { useEffect, useRef, useState } from 'react' import { toast } from 'sonner' -import { IS_PLATFORM, useFlag } from 'common' import { useDeploymentCommitQuery } from 'data/utils/deployment-commit-query' import { Button, StatusIcon } from 'ui' +import { useFlag } from 'common' const DeployCheckToast = ({ id }: { id: string | number }) => { const router = useRouter() @@ -39,10 +39,7 @@ export function useCheckLatestDeploy() { const [currentCommitTime, setCurrentCommitTime] = useState('') const [isToastShown, setIsToastShown] = useState(false) - const { data: commit } = useDeploymentCommitQuery({ - enabled: IS_PLATFORM, - staleTime: 1000 * 60 * 10, // 10 minutes - }) + const { data: commit } = useDeploymentCommitQuery() const commitLoggedRef = useRef(false) useEffect(() => {