Dear Gitlab users, due to maintenance reasons, Gitlab will not be available on Thursday 30.09.2021 from 5:00 pm to approximately 5:30 pm.

Commit fc023834 authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: don't put query client in module state

parent f4373b4e
Pipeline #189948 passed with stages
in 11 minutes and 19 seconds
......@@ -16,7 +16,7 @@ import Head from 'next/head'
import { Router } from 'next/router'
import np from 'nprogress'
import type { PropsWithChildren } from 'react'
import { Fragment } from 'react'
import { Fragment, useState } from 'react'
import { QueryClient, QueryClientProvider } from 'react-query'
import { ReactQueryDevtools } from 'react-query/devtools'
import { Slide, ToastContainer } from 'react-toastify'
......@@ -66,22 +66,28 @@ Router.events.on('routeChangeComplete', stopProgressIndicator)
Router.events.on('routeChangeError', stopProgressIndicator)
/**
* Client side cache for server data.
* Create client side cache for server data.
*/
const queryClient = new QueryClient({
defaultOptions: {
queries: {
cacheTime: Infinity,
staleTime: Infinity,
structuralSharing: false,
function createQueryClient() {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
cacheTime: Infinity,
staleTime: Infinity,
structuralSharing: false,
},
},
},
})
})
return queryClient
}
/**
* Providers.
*/
function Providers({ children }: PropsWithChildren<unknown>) {
const [queryClient] = useState(() => createQueryClient())
useInteractionModality()
return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment