{"version":3,"file":"useQuery.cjs","names":["reuseQuery"],"sources":["../../../../src/api/hooks/useQuery/useQuery.ts"],"sourcesContent":["import { useQuery as createToolsQuery } from '@pastweb/tools/api/hooks/useQuery';\nimport { reuseQuery } from '../reuseQuery';\nimport type { QueryConfig, QueryInfo } from '@pastweb/tools/api/hooks/useQuery';\n\n/**\n * React wrapper for `@pastweb/tools` `useQuery`.\n *\n * The underlying query state machine is created once and remains owned by the\n * tools package. React re-renders when the returned reactive query fields\n * change. If the query needs providers or a shared cache, configure those in\n * the agent used by `config.fn` or install the cache via `installApiCache` /\n * `ApiQueryProvider`.\n *\n * @example\n * ```tsx\n * const users = useQuery({\n *   fn: () => agent.get('/api/users', { queryKey: ['users'] }),\n * });\n *\n * if (users.isLoading) return <Spinner />;\n * return <UserList users={users.data ?? []} />;\n * ```\n */\nexport function useQuery<T>(config: QueryConfig<T>): QueryInfo<T> {\n  return reuseQuery(() => createToolsQuery(config));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,SAAY,QAAsC;CAChE,OAAOA,wCAAAA,kBAAAA,GAAAA,kCAAAA,SAAAA,CAAkC,MAAM,CAAC;AAClD"}