|
1 | 1 | import React, { useEffect, useState } from 'react';
|
2 | 2 | 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'; |
6 | 3 |
|
7 | 4 | import { SessionProvider } from 'next-auth/react';
|
8 | 5 | import { NextAdapter } from 'next-query-params';
|
@@ -36,22 +33,12 @@ import '../font/inter.css';
|
36 | 33 |
|
37 | 34 | type AppOwnProps = { orchestratorConfig: OrchestratorConfig };
|
38 | 35 |
|
39 |
| -const queryClientConfig: QueryClientConfig = { |
40 |
| - defaultOptions: { |
41 |
| - queries: { |
42 |
| - cacheTime: 5 * 1000, |
43 |
| - refetchOnWindowFocus: true, |
44 |
| - }, |
45 |
| - }, |
46 |
| -}; |
47 |
| - |
48 | 36 | function CustomApp({
|
49 | 37 | Component,
|
50 | 38 | pageProps,
|
51 | 39 | orchestratorConfig,
|
52 | 40 | }: AppProps & AppOwnProps) {
|
53 | 41 | const router = useRouter();
|
54 |
| - const [queryClient] = useState(() => new QueryClient(queryClientConfig)); |
55 | 42 |
|
56 | 43 | const [themeMode, setThemeMode] = useState<EuiThemeColorMode>(
|
57 | 44 | ColorModes.LIGHT,
|
@@ -106,56 +93,46 @@ function CustomApp({
|
106 | 93 | colorMode={themeMode}
|
107 | 94 | modify={defaultOrchestratorTheme}
|
108 | 95 | >
|
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 | + }} |
134 | 126 | >
|
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> |
159 | 136 | </EuiProvider>
|
160 | 137 | </WfoAuth>
|
161 | 138 | </NoSSR>
|
|
0 commit comments