Move the staleTime and enabled params as defaults in the query.

This commit is contained in:
Ivan Vasilov committed 2025-12-25 16:40:11 +01:00
1 parent 89e0fe4f28
commit 293d71a3fc
3 files changed
+6 -9

No files matched your search

@@ -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) => {
@@ -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 = <TData = DeploymentCommitData>({
useQuery<DeploymentCommitData, ResponseError, TData>({
queryKey: ['deployment-commit'],
queryFn: ({ signal }) => getDeploymentCommit(signal),
enabled: IS_PLATFORM && enabled,
staleTime: 1000 * 60 * 10, // 10 minutes
...options,
})
@@ -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(() => {