refactor(web): Migrate to Unified TanStack Devtools (#30279)

This commit is contained in:
yyh
2025-12-29 09:43:44 +08:00
committed by GitHub
parent 5b1c08c19c
commit 1e86535c4a
7 changed files with 319 additions and 11 deletions

View File

@@ -2,7 +2,14 @@
import type { FC, PropsWithChildren } from 'react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { lazy, Suspense } from 'react'
import { IS_DEV } from '@/config'
const TanStackDevtoolsWrapper = lazy(() =>
import('@/app/components/devtools').then(module => ({
default: module.TanStackDevtoolsWrapper,
})),
)
const STALE_TIME = 1000 * 60 * 30 // 30 minutes
@@ -19,7 +26,11 @@ export const TanstackQueryInitializer: FC<PropsWithChildren> = (props) => {
return (
<QueryClientProvider client={client}>
{children}
<ReactQueryDevtools initialIsOpen={false} />
{IS_DEV && (
<Suspense fallback={null}>
<TanStackDevtoolsWrapper />
</Suspense>
)}
</QueryClientProvider>
)
}