( queryClient?: Accessor<QueryClient | undefined>, )
| 28 | } |
| 29 | |
| 30 | export const useQueryClientResolver = ( |
| 31 | queryClient?: Accessor<QueryClient | undefined>, |
| 32 | ): Accessor<QueryClient> => { |
| 33 | const contextClient = useContext(QueryClientContext) |
| 34 | |
| 35 | return () => { |
| 36 | const resolvedClient = queryClient?.() |
| 37 | if (resolvedClient) { |
| 38 | return resolvedClient |
| 39 | } |
| 40 | |
| 41 | if (!contextClient) { |
| 42 | throw new Error(queryClientContextError) |
| 43 | } |
| 44 | |
| 45 | return contextClient() |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | export type QueryClientProviderProps = { |
| 50 | client: QueryClient |
no outgoing calls