diff --git a/web/src/components/workspace/FileExplorerPanel.tsx b/web/src/components/workspace/FileExplorerPanel.tsx index d5fcea6..86e4090 100644 --- a/web/src/components/workspace/FileExplorerPanel.tsx +++ b/web/src/components/workspace/FileExplorerPanel.tsx @@ -1,4 +1,5 @@ -import { ChevronRight, FileCode2, Folder } from "lucide-react"; +import { useQueryClient, useIsFetching } from "@tanstack/react-query"; +import { ChevronRight, FileCode2, Folder, RefreshCw } from "lucide-react"; import type { ReactNode } from "react"; import { ScrollArea } from "@/components/ui/scroll-area"; @@ -131,6 +132,9 @@ function EmptyState({ children }: { children: ReactNode }) { export function FileExplorerPanel({ workspaceId }: FileExplorerPanelProps) { const setActiveFilePath = useWorkspaceUiStore((s) => s.setActiveFilePath); const setSelectedPath = useFileTreeStore((s) => s.setSelectedPath); + const queryClient = useQueryClient(); + const filesQueryKey = ["workspaces", workspaceId ?? "", "files"] as const; + const isFetchingFiles = useIsFetching({ queryKey: filesQueryKey }) > 0; const { data, isLoading, error } = useFileList(workspaceId, "."); const onSelectFile = (path: string) => { @@ -138,12 +142,33 @@ export function FileExplorerPanel({ workspaceId }: FileExplorerPanelProps) { setActiveFilePath(path); }; + const refreshAll = () => { + queryClient.invalidateQueries({ queryKey: filesQueryKey }); + }; + + const header = ( +