Skip to content

Commit d3101c2

Browse files
committed
feat: improve data fetching
1 parent e24f3c3 commit d3101c2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/GnomeLibrary/utils/hooks/useFolders.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import type {
77
import { keepPreviousData, useQuery } from "@tanstack/react-query";
88
import ChrisAPIClient from "../../../../api/chrisapiclient";
99

10+
// Initialize client at module level
11+
const client = ChrisAPIClient.getClient();
12+
1013
// Define the interface for pagination
1114
interface PaginationInfo {
1215
totalCount: number;
@@ -31,13 +34,15 @@ export interface FolderHookData extends FolderTableData {
3134
errorMessages?: string[];
3235
}
3336

37+
/**
38+
* Fetches folder data from the API
39+
*/
3440
export async function fetchFolders(
3541
computedPath: string,
3642
pageNumber = 1,
3743
previousData?: FolderHookData,
3844
): Promise<FolderHookData> {
39-
const client = ChrisAPIClient.getClient();
40-
45+
// Use the already initialized client
4146
const itemsPerPage = 50;
4247
const errorMessages: string[] = [];
4348

0 commit comments

Comments
 (0)