|
1 | 1 | import type { QueryClient } from '@tanstack/react-query' |
2 | 2 | import type { SettingsSection } from '@/app/workspace/[workspaceId]/settings/navigation' |
| 3 | +import { forkLineageQueryOptions } from '@/ee/workspace-forking/hooks/workspace-fork' |
| 4 | +import { apiKeysQueryOptions } from '@/hooks/queries/api-key-list' |
| 5 | +import { customToolsQueryOptions } from '@/hooks/queries/custom-tools' |
| 6 | +import { |
| 7 | + personalEnvironmentQueryOptions, |
| 8 | + workspaceEnvironmentQueryOptions, |
| 9 | +} from '@/hooks/queries/environment' |
| 10 | +import { pendingInvitationsQueryOptions } from '@/hooks/queries/invitations' |
| 11 | +import { mcpServersQueryOptions } from '@/hooks/queries/mcp' |
3 | 12 | import { organizationBillingSummaryOptions } from '@/hooks/queries/organization-billing-summary' |
4 | 13 | import { subscriptionDataQueryOptions } from '@/hooks/queries/subscription-data' |
5 | 14 | import { workspaceCredentialListQueryOptions } from '@/hooks/queries/utils/fetch-workspace-credentials' |
6 | 15 | import { prefetchQueryOnIntent } from '@/hooks/queries/utils/prefetch-query-on-intent' |
| 16 | +import { workflowMcpServersQueryOptions } from '@/hooks/queries/workflow-mcp-servers' |
7 | 17 |
|
| 18 | +/** |
| 19 | + * Each section's first-content queries, started on navigation intent so they load alongside the |
| 20 | + * route payload instead of after the section mounts. |
| 21 | + */ |
8 | 22 | const SETTINGS_QUERY_WARMERS: Partial< |
9 | 23 | Record<SettingsSection, (queryClient: QueryClient, context: SettingsQueryWarmContext) => void> |
10 | 24 | > = { |
11 | | - secrets: (queryClient, { workspaceId }) => |
| 25 | + secrets: (queryClient, { workspaceId }) => { |
| 26 | + prefetchQueryOnIntent(queryClient, personalEnvironmentQueryOptions()) |
| 27 | + prefetchQueryOnIntent(queryClient, workspaceEnvironmentQueryOptions(workspaceId)) |
12 | 28 | prefetchQueryOnIntent( |
13 | 29 | queryClient, |
14 | 30 | workspaceCredentialListQueryOptions(workspaceId, 'env_workspace') |
15 | | - ), |
| 31 | + ) |
| 32 | + }, |
| 33 | + forks: (queryClient, { workspaceId }) => |
| 34 | + prefetchQueryOnIntent(queryClient, forkLineageQueryOptions(workspaceId)), |
| 35 | + teammates: (queryClient, { workspaceId }) => |
| 36 | + prefetchQueryOnIntent(queryClient, pendingInvitationsQueryOptions(workspaceId)), |
| 37 | + apikeys: (queryClient, { workspaceId }) => |
| 38 | + prefetchQueryOnIntent(queryClient, apiKeysQueryOptions(workspaceId, 'combined')), |
| 39 | + 'custom-tools': (queryClient, { workspaceId }) => |
| 40 | + prefetchQueryOnIntent(queryClient, customToolsQueryOptions(workspaceId)), |
| 41 | + mcp: (queryClient, { workspaceId }) => |
| 42 | + prefetchQueryOnIntent(queryClient, mcpServersQueryOptions(workspaceId)), |
| 43 | + 'workflow-mcp-servers': (queryClient, { workspaceId }) => |
| 44 | + prefetchQueryOnIntent(queryClient, workflowMcpServersQueryOptions(workspaceId)), |
16 | 45 | billing: (queryClient, { billingOrganizationId }) => { |
17 | 46 | if (billingOrganizationId) { |
18 | 47 | prefetchQueryOnIntent(queryClient, organizationBillingSummaryOptions(billingOrganizationId)) |
|
0 commit comments