Skip to content

Commit b0844f7

Browse files
committed
fix lazy loaded dev tools
1 parent 5c5adde commit b0844f7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pages/_app.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import { usePathname } from "next/navigation";
3434
import { useRouter } from "next/router";
3535
import { persistQueryClient } from "@tanstack/react-query-persist-client";
3636
import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister";
37+
3738
TimeAgo.addDefaultLocale(en);
38-
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
3939

4040
const queryClient = new QueryClient();
4141
const clientSideEmotionCache = createEmotionCache();
@@ -70,7 +70,7 @@ const App = (props) => {
7070
if (!queryKey || !queryKey.length) {
7171
return false;
7272
}
73-
const queryKeyString = String(queryKey[0] || '');
73+
const queryKeyString = String(queryKey[0] || "");
7474
const excludeFromPersisting = excludeQueryKeys.some((key) =>
7575
queryKeyString.includes(key)
7676
);
@@ -132,6 +132,12 @@ const App = (props) => {
132132
},
133133
];
134134

135+
const ReactQueryDevtoolsProduction = React.lazy(() =>
136+
import("@tanstack/react-query-devtools/build/modern/production.js").then((d) => ({
137+
default: d.ReactQueryDevtools,
138+
}))
139+
);
140+
135141
return (
136142
<CacheProvider value={emotionCache}>
137143
<Head>
@@ -178,7 +184,7 @@ const App = (props) => {
178184
</ThemeProvider>
179185
{settings.isInitialized && settings?.showDevtools === true ? (
180186
<React.Suspense fallback={null}>
181-
<ReactQueryDevtools />
187+
<ReactQueryDevtoolsProduction />
182188
</React.Suspense>
183189
) : null}
184190
</>

0 commit comments

Comments
 (0)