mirror of
https://github.com/langgenius/dify.git
synced 2026-09-07 18:36:02 +08:00
Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: fatelei <fatelei@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: 姜涵煦 <hanxujiang@jianghanxudeMacBook-Pro-2.local> Co-authored-by: L1nSn0w <l1nsn0w@qq.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
21 lines
707 B
TypeScript
21 lines
707 B
TypeScript
import type { DehydratedState } from '@tanstack/react-query'
|
|
import type { SearchParams } from 'nuqs/server'
|
|
import { HydrationBoundary } from '@tanstack/react-query'
|
|
import { prefetchMarketplaceDehydratedState } from './prefetch-marketplace-dehydrated-state'
|
|
|
|
export async function HydrateQueryClient({
|
|
searchParams,
|
|
prefetchedState,
|
|
children,
|
|
}: {
|
|
searchParams: Promise<SearchParams> | undefined
|
|
prefetchedState?: DehydratedState
|
|
children: React.ReactNode
|
|
}) {
|
|
const dehydratedState =
|
|
prefetchedState === undefined
|
|
? await prefetchMarketplaceDehydratedState(searchParams)
|
|
: prefetchedState
|
|
return <HydrationBoundary state={dehydratedState}>{children}</HydrationBoundary>
|
|
}
|