refactor: import SandboxProvider type from @/types and remove retry:0

Move type imports to @/types/sandbox-provider instead of re-exporting
from service file. Remove unnecessary retry:0 options to use React
Query's default retry behavior.
This commit is contained in:
yyh 2026-01-14 10:10:04 +08:00
parent 3b78f9c2a5
commit 2279b605c6
No known key found for this signature in database
5 changed files with 4 additions and 9 deletions

View File

@ -1,7 +1,7 @@
'use client'
import type { FormRefObject, FormSchema } from '@/app/components/base/form/types'
import type { SandboxProvider } from '@/service/use-sandbox-provider'
import type { SandboxProvider } from '@/types/sandbox-provider'
import { RiExternalLinkLine, RiLock2Fill } from '@remixicon/react'
import { memo, useCallback, useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'

View File

@ -1,6 +1,6 @@
'use client'
import type { SandboxProvider } from '@/service/use-sandbox-provider'
import type { SandboxProvider } from '@/types/sandbox-provider'
import { memo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Loading from '@/app/components/base/loading'

View File

@ -1,6 +1,6 @@
'use client'
import type { SandboxProvider } from '@/service/use-sandbox-provider'
import type { SandboxProvider } from '@/types/sandbox-provider'
import { RiEqualizer2Line } from '@remixicon/react'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'

View File

@ -1,6 +1,6 @@
'use client'
import type { SandboxProvider } from '@/service/use-sandbox-provider'
import type { SandboxProvider } from '@/types/sandbox-provider'
import { memo, useCallback } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'

View File

@ -5,13 +5,10 @@ import {
} from '@tanstack/react-query'
import { consoleClient, consoleQuery } from '@/service/client'
export type { ConfigSchema, SandboxProvider } from '@/types/sandbox-provider'
export const useGetSandboxProviderList = () => {
return useQuery({
queryKey: consoleQuery.getSandboxProviderList.queryKey(),
queryFn: () => consoleClient.getSandboxProviderList(),
retry: 0,
})
}
@ -19,7 +16,6 @@ export const useGetSandboxProvider = (providerType: string) => {
return useQuery({
queryKey: consoleQuery.getSandboxProvider.queryKey({ input: { params: { providerType } } }),
queryFn: () => consoleClient.getSandboxProvider({ params: { providerType } }),
retry: 0,
enabled: !!providerType,
})
}
@ -74,6 +70,5 @@ export const useGetActiveSandboxProvider = () => {
return useQuery({
queryKey: consoleQuery.getActiveSandboxProvider.queryKey(),
queryFn: () => consoleClient.getActiveSandboxProvider(),
retry: 0,
})
}