()
| 10 | let browserQueryClient: QueryClient | undefined = undefined |
| 11 | |
| 12 | function getQueryClient() { |
| 13 | if (isServer) { |
| 14 | // Server: always make a new query client |
| 15 | return makeQueryClient() |
| 16 | } else { |
| 17 | // Browser: make a new query client if we don't already have one |
| 18 | // This is very important, so we don't re-make a new client if React |
| 19 | // suspends during the initial render. This may not be needed if we |
| 20 | // have a suspense boundary BELOW the creation of the query client |
| 21 | if (!browserQueryClient) browserQueryClient = makeQueryClient() |
| 22 | return browserQueryClient |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | export default function Providers({ children }: { children: React.ReactNode }) { |
| 27 | // NOTE: Avoid useState when initializing the query client if you don't |
no test coverage detected