mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
refactor(web): replace query option tunneling with queryOptions factories
Extract sandboxFilesTreeOptions and buildTreeFromFlatList from useSandboxFilesTree so callers that need custom TanStack Query behavior (e.g. refetchInterval) can compose at the call site instead of tunneling options through the hook. Remove the thin useGetSandboxProviderList wrapper in favor of inline oRPC queryOptions in the component. Also remove redundant .input(type<unknown>()) from three no-input GET contracts—oc already defaults TInputSchema to Schema<unknown, unknown>.
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import type { SandboxProvider } from '@/types/sandbox-provider'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { memo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useGetSandboxProviderList } from '@/service/use-sandbox-provider'
|
||||
import { consoleQuery } from '@/service/client'
|
||||
import ConfigModal from './config-modal'
|
||||
import ProviderCard from './provider-card'
|
||||
import SwitchModal from './switch-modal'
|
||||
@ -13,7 +14,7 @@ import SwitchModal from './switch-modal'
|
||||
const SandboxProviderPage = () => {
|
||||
const { t } = useTranslation()
|
||||
const { isCurrentWorkspaceManager, isLoadingCurrentWorkspace } = useAppContext()
|
||||
const { data: providers, isLoading } = useGetSandboxProviderList()
|
||||
const { data: providers, isLoading } = useQuery(consoleQuery.sandboxProvider.getSandboxProviderList.queryOptions())
|
||||
|
||||
const [configModalProvider, setConfigModalProvider] = useState<SandboxProvider | null>(null)
|
||||
const [switchModalProvider, setSwitchModalProvider] = useState<SandboxProvider | null>(null)
|
||||
|
||||
Reference in New Issue
Block a user