(workspaceId: string, fileId: string)
| 72 | * for the workspace and selects the matching record via `select`. |
| 73 | */ |
| 74 | export function useWorkspaceFileRecord(workspaceId: string, fileId: string) { |
| 75 | return useQuery({ |
| 76 | queryKey: workspaceFilesKeys.list(workspaceId, 'active'), |
| 77 | queryFn: ({ signal }) => fetchWorkspaceFiles(workspaceId, 'active', signal), |
| 78 | enabled: !!workspaceId && !!fileId, |
| 79 | staleTime: 30 * 1000, |
| 80 | select: (files) => files.find((f) => f.id === fileId) ?? null, |
| 81 | }) |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Fetch workspace files from API |
no test coverage detected