Skip to content

Commit cf7802a

Browse files
authored
cleanup: inline getUseApiQueryClient (#2565)
inline getUseApiQueryClient
1 parent 6fe6936 commit cf7802a

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

app/api/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
getUseApiMutation,
1313
getUseApiQueries,
1414
getUseApiQuery,
15-
getUseApiQueryClient,
1615
getUseApiQueryErrorsAllowed,
1716
getUsePrefetchedApiQuery,
1817
wrapQueryClient,
@@ -53,5 +52,6 @@ export const queryClient = new QueryClient({
5352
// don't have access to context
5453
export const apiQueryClient = wrapQueryClient(api.methods, queryClient)
5554

56-
// to be used to retrieve the typed query client in components
57-
export const useApiQueryClient = getUseApiQueryClient(api.methods)
55+
// used to retrieve the typed query client in components. doesn't need to exist:
56+
// we could import apiQueryClient directly everywhere, but the change is noisy
57+
export const useApiQueryClient = () => apiQueryClient

app/api/hooks.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
useMutation,
1010
useQueries,
1111
useQuery,
12-
useQueryClient,
1312
type DefaultError,
1413
type FetchQueryOptions,
1514
type InvalidateQueryFilters,
@@ -314,12 +313,7 @@ export const wrapQueryClient = <A extends ApiClient>(api: A, queryClient: QueryC
314313
}),
315314
})
316315

317-
export const getUseApiQueryClient =
318-
<A extends ApiClient>(api: A) =>
319-
() =>
320-
wrapQueryClient(api, useQueryClient())
321-
322-
/*
316+
/*
323317
1. what's up with [method, params]?
324318
325319
https://react-query.tanstack.com/guides/queries

0 commit comments

Comments
 (0)