import { ReactNode } from 'react'; import type { GQlessClient, HydrateCacheOptions } from 'gqless'; import type { ReactClientOptionsWithDefaults } from '../utils'; export interface UseHydrateCacheOptions extends Partial { /** * Cache snapshot, returned from `prepareReactRender` */ cacheSnapshot: string | undefined; /** * If it should refetch everything after the component is mounted * * @default * false */ shouldRefetch?: boolean; } /** * Props with `cacheSnapshot` that would be returned from `prepareReactRender` */ export declare type PropsWithServerCache = {}> = { /** * Cache snapshot, returned from `prepareReactRender` */ cacheSnapshot?: string; } & T; export interface UseHydrateCache { ({ cacheSnapshot, shouldRefetch }: UseHydrateCacheOptions): void; } export interface PrepareReactRender { (element: ReactNode): Promise<{ cacheSnapshot: string; }>; } export declare function createSSRHelpers(client: GQlessClient, { defaults: { refetchAfterHydrate } }: ReactClientOptionsWithDefaults): { useHydrateCache: UseHydrateCache; prepareReactRender: PrepareReactRender; };