Skip to content

Commit a718198

Browse files
author
Ruben van Leeuwen
committed
1191: Update react query
1 parent f998089 commit a718198

File tree

1 file changed

+39
-62
lines changed

1 file changed

+39
-62
lines changed

pages/_app.tsx

Lines changed: 39 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import React, { useEffect, useState } from 'react';
22
import NoSSR from 'react-no-ssr';
3-
import { QueryClient, QueryClientProvider } from 'react-query';
4-
import { ReactQueryDevtools } from 'react-query/devtools';
5-
import { QueryClientConfig } from 'react-query/types/core/types';
63

74
import { SessionProvider } from 'next-auth/react';
85
import { NextAdapter } from 'next-query-params';
@@ -36,22 +33,12 @@ import '../font/inter.css';
3633

3734
type AppOwnProps = { orchestratorConfig: OrchestratorConfig };
3835

39-
const queryClientConfig: QueryClientConfig = {
40-
defaultOptions: {
41-
queries: {
42-
cacheTime: 5 * 1000,
43-
refetchOnWindowFocus: true,
44-
},
45-
},
46-
};
47-
4836
function CustomApp({
4937
Component,
5038
pageProps,
5139
orchestratorConfig,
5240
}: AppProps & AppOwnProps) {
5341
const router = useRouter();
54-
const [queryClient] = useState(() => new QueryClient(queryClientConfig));
5542

5643
const [themeMode, setThemeMode] = useState<EuiThemeColorMode>(
5744
ColorModes.LIGHT,
@@ -106,56 +93,46 @@ function CustomApp({
10693
colorMode={themeMode}
10794
modify={defaultOrchestratorTheme}
10895
>
109-
<QueryClientProvider
110-
client={queryClient}
111-
contextSharing={true}
112-
>
113-
<TranslationsProvider>
114-
<Head>
115-
<link
116-
rel="icon"
117-
href="/favicon.png"
118-
/>
119-
<title>
120-
Welcome to
121-
example-orchestrator-ui!
122-
</title>
123-
</Head>
124-
<main className="app">
125-
<ConfirmationDialogContextWrapper>
126-
<WfoPageTemplate
127-
getAppLogo={getAppLogo}
128-
onThemeSwitch={
129-
handleThemeSwitch
130-
}
131-
overrideMenuItems={
132-
addMenuItems
133-
}
96+
<TranslationsProvider>
97+
<Head>
98+
<link
99+
rel="icon"
100+
href="/favicon.png"
101+
/>
102+
<title>
103+
Welcome to
104+
example-orchestrator-ui!
105+
</title>
106+
</Head>
107+
<main className="app">
108+
<ConfirmationDialogContextWrapper>
109+
<WfoPageTemplate
110+
getAppLogo={getAppLogo}
111+
onThemeSwitch={
112+
handleThemeSwitch
113+
}
114+
overrideMenuItems={
115+
addMenuItems
116+
}
117+
>
118+
<QueryParamProvider
119+
adapter={NextAdapter}
120+
options={{
121+
removeDefaultsFromUrl:
122+
false,
123+
enableBatching:
124+
true,
125+
}}
134126
>
135-
<QueryParamProvider
136-
adapter={
137-
NextAdapter
138-
}
139-
options={{
140-
removeDefaultsFromUrl:
141-
false,
142-
enableBatching:
143-
true,
144-
}}
145-
>
146-
<Component
147-
{...pageProps}
148-
/>
149-
</QueryParamProvider>
150-
</WfoPageTemplate>
151-
<WfoToastsList />
152-
</ConfirmationDialogContextWrapper>
153-
<ReactQueryDevtools
154-
initialIsOpen={false}
155-
/>
156-
</main>
157-
</TranslationsProvider>
158-
</QueryClientProvider>
127+
<Component
128+
{...pageProps}
129+
/>
130+
</QueryParamProvider>
131+
</WfoPageTemplate>
132+
<WfoToastsList />
133+
</ConfirmationDialogContextWrapper>
134+
</main>
135+
</TranslationsProvider>
159136
</EuiProvider>
160137
</WfoAuth>
161138
</NoSSR>

0 commit comments

Comments
 (0)