( queryClient?: Accessor<QueryClient | undefined>, )
| 39 | } |
| 40 | |
| 41 | export const useQueryClientResolver = ( |
| 42 | queryClient?: Accessor<QueryClient | undefined>, |
| 43 | ): Accessor<QueryClient> => { |
| 44 | const contextClient = useContext(QueryClientContext) |
| 45 | |
| 46 | return () => { |
| 47 | const resolvedClient = queryClient?.() |
| 48 | if (resolvedClient) { |
| 49 | return resolvedClient |
| 50 | } |
| 51 | |
| 52 | if (!contextClient) { |
| 53 | throw new Error(queryClientContextError) |
| 54 | } |
| 55 | |
| 56 | return contextClient() |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * The props accepted by `QueryClientProvider`. |
no outgoing calls