MCPcopy Index your code
hub / github.com/simstudioai/sim / useWorkspaceFiles

Function useWorkspaceFiles

apps/sim/hooks/queries/workspace-files.ts:103–115  ·  view source on GitHub ↗
(
  workspaceId: string,
  scope: WorkspaceFileQueryScope = 'active',
  options?: { enabled?: boolean }
)

Source from the content-addressed store, hash-verified

101 * Hook to fetch workspace files
102 */
103export 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

Callers 13

FilesFunction · 0.90
useMarkdownMentionsFunction · 0.90
SimResourceCellFunction · 0.90
HomeFunction · 0.90
EmbeddedFileActionsFunction · 0.90
EmbeddedFileFunction · 0.90
useAvailableResourcesFunction · 0.90
useResourceNameLookupFunction · 0.90
WorkspaceResourceDisplayFunction · 0.90
RecentlyDeletedFunction · 0.90
sidebar.tsxFile · 0.90

Calls 1

fetchWorkspaceFilesFunction · 0.85

Tested by

no test coverage detected