diff options
Diffstat (limited to 'opendc-web/opendc-web-ui/src/pages/_app.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/pages/_app.js | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/opendc-web/opendc-web-ui/src/pages/_app.js b/opendc-web/opendc-web-ui/src/pages/_app.js index c1adbd6e..6a7200d5 100644 --- a/opendc-web/opendc-web-ui/src/pages/_app.js +++ b/opendc-web/opendc-web-ui/src/pages/_app.js @@ -28,15 +28,30 @@ import '../index.scss' import { AuthProvider, useAuth } from '../auth' import * as Sentry from '@sentry/react' import { Integrations } from '@sentry/tracing' +import { QueryClient, QueryClientProvider } from 'react-query' +import { useMemo } from 'react' +import { configureProjectClient } from '../data/project' +import { configureExperimentClient } from '../data/experiments' +import { configureTopologyClient } from '../data/topology' // This setup is necessary to forward the Auth0 context to the Redux context const Inner = ({ Component, pageProps }) => { const auth = useAuth() - const store = useStore(pageProps.initialReduxState, { auth }) + + const queryClient = useMemo(() => { + const client = new QueryClient() + configureProjectClient(client, auth) + configureExperimentClient(client, auth) + configureTopologyClient(client, auth) + return client + }, []) // eslint-disable-line react-hooks/exhaustive-deps + const store = useStore(pageProps.initialReduxState, { auth, queryClient }) return ( - <Provider store={store}> - <Component {...pageProps} /> - </Provider> + <QueryClientProvider client={queryClient}> + <Provider store={store}> + <Component {...pageProps} /> + </Provider> + </QueryClientProvider> ) } |
