Spaces:
Build error
Build error
File size: 718 Bytes
b59aa07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import { useQuery } from "@tanstack/react-query";
import OpenHands from "#/api/open-hands";
import { GitChangeStatus } from "#/api/open-hands.types";
import { useConversationId } from "#/hooks/use-conversation-id";
type UseGetDiffConfig = {
filePath: string;
type: GitChangeStatus;
enabled: boolean;
};
export const useGitDiff = (config: UseGetDiffConfig) => {
const { conversationId } = useConversationId();
return useQuery({
queryKey: ["file_diff", conversationId, config.filePath, config.type],
queryFn: () => OpenHands.getGitChangeDiff(conversationId, config.filePath),
enabled: config.enabled,
staleTime: 1000 * 60 * 5, // 5 minutes
gcTime: 1000 * 60 * 15, // 15 minutes
});
};
|