Skip to content

Commit

Permalink
Better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
amanape committed Nov 22, 2024
1 parent a1aa5ab commit cbb6a27
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/file-explorer/FileExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { RootState } from "#/store";
import { I18nKey } from "#/i18n/declaration";
import OpenHands from "#/api/open-hands";
import VSCodeIcon from "#/assets/vscode-alt.svg?react";
import { useGetFiles } from "#/hooks/query/use-get-files";
import { useListFiles } from "#/hooks/query/use-list-files";
import { FileUploadSuccessResponse } from "#/api/open-hands.types";
import { useUploadFiles } from "#/hooks/mutation/use-upload-files";

Expand Down Expand Up @@ -107,7 +107,7 @@ function FileExplorer({ isOpen, onToggle }: FileExplorerProps) {
fileInputRef.current?.click(); // Trigger the file browser
};

const { data: paths, refetch, error } = useGetFiles();
const { data: paths, refetch, error } = useListFiles();

const handleUploadSuccess = (data: FileUploadSuccessResponse) => {
const uploadedCount = data.uploaded_files.length;
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/file-explorer/TreeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import FolderIcon from "../FolderIcon";
import FileIcon from "../FileIcons";
import { useFiles } from "#/context/files";
import { cn } from "#/utils/utils";
import { useGetFiles } from "#/hooks/query/use-get-files";
import { useGetFile } from "#/hooks/query/use-get-file";
import { useListFiles } from "#/hooks/query/use-list-files";
import { useListFile } from "#/hooks/query/use-list-file";

interface TitleProps {
name: string;
Expand Down Expand Up @@ -45,12 +45,12 @@ function TreeNode({ path, defaultOpen = false }: TreeNodeProps) {

const isDirectory = path.endsWith("/");

const { data: paths } = useGetFiles({
const { data: paths } = useListFiles({
path,
enabled: isDirectory && isOpen,
});

const { data: fileContent, refetch } = useGetFile({ path });
const { data: fileContent, refetch } = useListFile({ path });

React.useEffect(() => {
if (fileContent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { useQuery } from "@tanstack/react-query";
import OpenHands from "#/api/open-hands";
import { useAuth } from "#/context/auth-context";

interface UseGetFileConfig {
interface UseListFileConfig {
path: string;
}

export const useGetFile = (config: UseGetFileConfig) => {
export const useListFile = (config: UseListFileConfig) => {
const { token } = useAuth();

return useQuery({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface UseListFilesConfig {
enabled?: boolean;
}

export const useGetFiles = (config?: UseListFilesConfig) => {
export const useListFiles = (config?: UseListFilesConfig) => {
const { token } = useAuth();
const { status } = useWsClient();
const isActive = status === WsClientProviderStatus.ACTIVE;
Expand Down

0 comments on commit cbb6a27

Please sign in to comment.