(
workspaceId: string,
scope: WorkspaceFileQueryScope = 'active',
options?: { enabled?: boolean }
)
| 101 | * Hook to fetch workspace files |
| 102 | */ |
| 103 | export function useWorkspaceFiles( |
| 104 | workspaceId: string, |
| 105 | scope: WorkspaceFileQueryScope = 'active', |
| 106 | options?: { enabled?: boolean } |
| 107 | ) { |
| 108 | return useQuery({ |
| 109 | queryKey: workspaceFilesKeys.list(workspaceId, scope), |
| 110 | queryFn: ({ signal }) => fetchWorkspaceFiles(workspaceId, scope, signal), |
| 111 | enabled: !!workspaceId && (options?.enabled ?? true), |
| 112 | staleTime: 30 * 1000, // 30 seconds - files can change frequently |
| 113 | placeholderData: keepPreviousData, // Show cached data immediately |
| 114 | }) |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Fetch file content as text via a content-source URL |
no test coverage detected