Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
getUseApiMutation,
getUseApiQueries,
getUseApiQuery,
getUseApiQueryClient,
getUseApiQueryErrorsAllowed,
getUsePrefetchedApiQuery,
wrapQueryClient,
Expand Down Expand Up @@ -53,5 +52,6 @@ export const queryClient = new QueryClient({
// don't have access to context
export const apiQueryClient = wrapQueryClient(api.methods, queryClient)

// to be used to retrieve the typed query client in components
export const useApiQueryClient = getUseApiQueryClient(api.methods)
// used to retrieve the typed query client in components. doesn't need to exist:
// we could import apiQueryClient directly everywhere, but the change is noisy
export const useApiQueryClient = () => apiQueryClient
8 changes: 1 addition & 7 deletions app/api/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
useMutation,
useQueries,
useQuery,
useQueryClient,
type DefaultError,
type FetchQueryOptions,
type InvalidateQueryFilters,
Expand Down Expand Up @@ -314,12 +313,7 @@ export const wrapQueryClient = <A extends ApiClient>(api: A, queryClient: QueryC
}),
})

export const getUseApiQueryClient =
<A extends ApiClient>(api: A) =>
() =>
wrapQueryClient(api, useQueryClient())

/*
/*
1. what's up with [method, params]?

https://react-query.tanstack.com/guides/queries
Expand Down
Loading