Files
dify/web/context/query-client-server.ts
yyh 97417d7895 fix: improve TanStack Query client setup and fix queryKey bug
- Fix double-nested queryKey array in usePluginManifestInfo that broke
  invalidateQueries prefix matching
- Remove unnecessary useState in TanstackQueryInitializer per Advanced SSR guide
  https://tanstack.com/query/v5/docs/framework/react/guides/advanced-ssr#initial-setup
- Reduce default staleTime from 30min to 5min (matching gcTime default)
- Fix nuqs SearchParams import to use nuqs/server for consistency
2026-02-19 23:16:15 +08:00

17 lines
346 B
TypeScript

import { QueryClient } from '@tanstack/react-query'
import { cache } from 'react'
const STALE_TIME = 1000 * 60 * 5 // 5 minutes
export function makeQueryClient() {
return new QueryClient({
defaultOptions: {
queries: {
staleTime: STALE_TIME,
},
},
})
}
export const getQueryClientServer = cache(makeQueryClient)