mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 12:59:18 +08:00
tweaks
This commit is contained in:
parent
e56d820ac4
commit
f7cf0c050e
@ -1,15 +0,0 @@
|
||||
import type { QueryClient } from '@tanstack/react-query'
|
||||
import { isServer } from '@/utils/client'
|
||||
import { makeQueryClient } from './query-client-server'
|
||||
|
||||
let browserQueryClient: QueryClient | undefined
|
||||
|
||||
export function getQueryClient() {
|
||||
if (isServer)
|
||||
return makeQueryClient()
|
||||
|
||||
if (!browserQueryClient)
|
||||
browserQueryClient = makeQueryClient()
|
||||
|
||||
return browserQueryClient
|
||||
}
|
||||
@ -1,8 +1,21 @@
|
||||
'use client'
|
||||
|
||||
import type { QueryClient } from '@tanstack/react-query'
|
||||
import { QueryClientProvider } from '@tanstack/react-query'
|
||||
import { TanStackDevtoolsLoader } from '@/app/components/devtools/tanstack/loader'
|
||||
import { getQueryClient } from './get-query-client'
|
||||
import { isServer } from '@/utils/client'
|
||||
import { makeQueryClient } from './query-client-server'
|
||||
|
||||
let browserQueryClient: QueryClient | undefined
|
||||
|
||||
function getQueryClient() {
|
||||
if (isServer) {
|
||||
return makeQueryClient()
|
||||
}
|
||||
if (!browserQueryClient)
|
||||
browserQueryClient = makeQueryClient()
|
||||
return browserQueryClient
|
||||
}
|
||||
|
||||
export const TanstackQueryInitializer = ({ children }: { children: React.ReactNode }) => {
|
||||
const queryClient = getQueryClient()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user