import type { TPrefetchOptions, TQueryFetcher, TQueryKey } from "./types.js"; /** * Prefetch query data before component mounts * Populates cache for later use by query() * * Unlike query(), prefetchQuery doesn't create a reactive store. * It simply loads data into the cache for instant availability when query() is called. * * @param key Query key to prefetch * @param fetcher Async function to fetch data * @param options Prefetch configuration options * @returns Promise that resolves when prefetch completes (or fails silently) * * @example * Basic usage: * ```typescript * // Prefetch on route change * router.beforeEach(async (to) => { * if (to.path === '/users') { * await prefetchQuery('users', fetchUsers); * } * }); * * // Later, component mounts * const usersQuery = query('users', fetchUsers); * // → isLoading = false (cache hit!) * // → data = [prefetched users] * ``` * * @example * With staleTime: * ```typescript * // Only prefetch if data is stale * await prefetchQuery('users', fetchUsers, { staleTime: 5000 }); * ``` * * @example * Force refetch: * ```typescript * // Always fetch regardless of cache * await prefetchQuery('users', fetchUsers, { force: true }); * ``` */ export declare function prefetchQuery(key: TQueryKey, fetcher: TQueryFetcher, options?: TPrefetchOptions): Promise;