Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SSHOC
sshoc-marketplace-frontend
Commits
fc023834
Commit
fc023834
authored
Apr 21, 2021
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/pages/_app.tsx
View file @
fc023834
...
...
@@ -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.
* C
reate c
lient 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
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment