@tanstack/vue-query 5.105.0 → 5.105.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/build/legacy/devtools/devtools.cjs +1 -2
  2. package/build/legacy/devtools/devtools.d.cts +1 -3
  3. package/build/legacy/devtools/devtools.d.cts.map +1 -1
  4. package/build/legacy/devtools/devtools.d.ts +1 -3
  5. package/build/legacy/devtools/devtools.d.ts.map +1 -1
  6. package/build/legacy/devtools/devtools.js +1 -2
  7. package/build/legacy/devtools/utils.cjs +1 -2
  8. package/build/legacy/devtools/utils.d.cts +0 -2
  9. package/build/legacy/devtools/utils.d.cts.map +1 -1
  10. package/build/legacy/devtools/utils.d.ts +0 -2
  11. package/build/legacy/devtools/utils.d.ts.map +1 -1
  12. package/build/legacy/devtools/utils.js +1 -2
  13. package/build/legacy/index.d.cts +4 -4
  14. package/build/legacy/index.d.ts +4 -4
  15. package/build/legacy/{infiniteQueryOptions-CoRGgnPB.d.ts → infiniteQueryOptions-BLGtkUwV.d.ts} +28 -33
  16. package/build/legacy/infiniteQueryOptions-BLGtkUwV.d.ts.map +1 -0
  17. package/build/legacy/{infiniteQueryOptions-BOLnyklt.d.cts → infiniteQueryOptions-oStzZOCq.d.cts} +28 -33
  18. package/build/legacy/infiniteQueryOptions-oStzZOCq.d.cts.map +1 -0
  19. package/build/legacy/infiniteQueryOptions.cjs +1 -2
  20. package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
  21. package/build/legacy/infiniteQueryOptions.d.cts +1 -1
  22. package/build/legacy/infiniteQueryOptions.d.ts +1 -1
  23. package/build/legacy/infiniteQueryOptions.js +1 -2
  24. package/build/legacy/infiniteQueryOptions.js.map +1 -1
  25. package/build/legacy/mutationCache.cjs +1 -2
  26. package/build/legacy/mutationCache.d.cts +1 -3
  27. package/build/legacy/mutationCache.d.cts.map +1 -1
  28. package/build/legacy/mutationCache.d.ts +1 -3
  29. package/build/legacy/mutationCache.d.ts.map +1 -1
  30. package/build/legacy/mutationCache.js +1 -2
  31. package/build/legacy/mutationOptions.cjs +1 -2
  32. package/build/legacy/mutationOptions.d.cts +1 -3
  33. package/build/legacy/mutationOptions.d.cts.map +1 -1
  34. package/build/legacy/mutationOptions.d.ts +1 -3
  35. package/build/legacy/mutationOptions.d.ts.map +1 -1
  36. package/build/legacy/mutationOptions.js +1 -2
  37. package/build/legacy/queryCache.cjs +1 -2
  38. package/build/legacy/queryCache.d.cts +1 -3
  39. package/build/legacy/queryCache.d.cts.map +1 -1
  40. package/build/legacy/queryCache.d.ts +1 -3
  41. package/build/legacy/queryCache.d.ts.map +1 -1
  42. package/build/legacy/queryCache.js +1 -2
  43. package/build/{modern/queryClient-D4OU6h40.d.ts → legacy/queryClient-CVne8UYf.d.ts} +4 -6
  44. package/build/legacy/queryClient-CVne8UYf.d.ts.map +1 -0
  45. package/build/{modern/queryClient-4Y1X98Y3.d.cts → legacy/queryClient-DdZQqhoA.d.cts} +4 -6
  46. package/build/legacy/queryClient-DdZQqhoA.d.cts.map +1 -0
  47. package/build/legacy/queryClient.cjs +1 -2
  48. package/build/legacy/queryClient.cjs.map +1 -1
  49. package/build/legacy/queryClient.d.cts +1 -1
  50. package/build/legacy/queryClient.d.ts +1 -1
  51. package/build/legacy/queryClient.js +1 -2
  52. package/build/legacy/queryClient.js.map +1 -1
  53. package/build/{modern/queryOptions-gpn5D4rf.d.ts → legacy/queryOptions-BuZEBLtg.d.cts} +16 -16
  54. package/build/legacy/queryOptions-BuZEBLtg.d.cts.map +1 -0
  55. package/build/{modern/queryOptions-BvmZtmiU.d.cts → legacy/queryOptions-dXiBZnGk.d.ts} +16 -16
  56. package/build/legacy/queryOptions-dXiBZnGk.d.ts.map +1 -0
  57. package/build/legacy/queryOptions.cjs +1 -2
  58. package/build/legacy/queryOptions.cjs.map +1 -1
  59. package/build/legacy/queryOptions.d.cts +1 -1
  60. package/build/legacy/queryOptions.d.ts +1 -1
  61. package/build/legacy/queryOptions.js +1 -2
  62. package/build/legacy/queryOptions.js.map +1 -1
  63. package/build/legacy/{types-sdZdiLgo.d.ts → types-u_Tu5Ybs.d.cts} +1 -3
  64. package/build/legacy/{types-sdZdiLgo.d.ts.map → types-u_Tu5Ybs.d.cts.map} +1 -1
  65. package/build/{modern/types-sdZdiLgo.d.ts → legacy/types-u_Tu5Ybs.d.ts} +1 -3
  66. package/build/legacy/types-u_Tu5Ybs.d.ts.map +1 -0
  67. package/build/legacy/types.d.cts +1 -1
  68. package/build/legacy/types.d.ts +1 -1
  69. package/build/legacy/useBaseQuery.cjs +1 -2
  70. package/build/legacy/useBaseQuery.d.cts +1 -1
  71. package/build/legacy/useBaseQuery.d.ts +1 -1
  72. package/build/legacy/useBaseQuery.js +1 -2
  73. package/build/legacy/useInfiniteQuery.cjs +1 -2
  74. package/build/legacy/useInfiniteQuery.cjs.map +1 -1
  75. package/build/legacy/useInfiniteQuery.d.cts +1 -1
  76. package/build/legacy/useInfiniteQuery.d.ts +1 -1
  77. package/build/legacy/useInfiniteQuery.js +1 -2
  78. package/build/legacy/useInfiniteQuery.js.map +1 -1
  79. package/build/legacy/useIsFetching.cjs +1 -2
  80. package/build/legacy/useIsFetching.cjs.map +1 -1
  81. package/build/legacy/useIsFetching.d.cts +3 -5
  82. package/build/legacy/useIsFetching.d.cts.map +1 -1
  83. package/build/legacy/useIsFetching.d.ts +3 -5
  84. package/build/legacy/useIsFetching.d.ts.map +1 -1
  85. package/build/legacy/useIsFetching.js +1 -2
  86. package/build/legacy/useIsFetching.js.map +1 -1
  87. package/build/legacy/useMutation.cjs +1 -2
  88. package/build/legacy/useMutation.d.cts +2 -4
  89. package/build/legacy/useMutation.d.cts.map +1 -1
  90. package/build/legacy/useMutation.d.ts +2 -4
  91. package/build/legacy/useMutation.d.ts.map +1 -1
  92. package/build/legacy/useMutation.js +1 -2
  93. package/build/legacy/useMutationState.cjs +1 -2
  94. package/build/legacy/useMutationState.d.cts +2 -4
  95. package/build/legacy/useMutationState.d.cts.map +1 -1
  96. package/build/legacy/useMutationState.d.ts +2 -4
  97. package/build/legacy/useMutationState.d.ts.map +1 -1
  98. package/build/legacy/useMutationState.js +1 -2
  99. package/build/legacy/usePrefetchInfiniteQuery.cjs +1 -2
  100. package/build/legacy/usePrefetchInfiniteQuery.d.cts +2 -4
  101. package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
  102. package/build/legacy/usePrefetchInfiniteQuery.d.ts +2 -4
  103. package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
  104. package/build/legacy/usePrefetchInfiniteQuery.js +1 -2
  105. package/build/legacy/usePrefetchQuery.cjs +1 -2
  106. package/build/legacy/usePrefetchQuery.d.cts +2 -4
  107. package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
  108. package/build/legacy/usePrefetchQuery.d.ts +2 -4
  109. package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
  110. package/build/legacy/usePrefetchQuery.js +1 -2
  111. package/build/legacy/useQueries.cjs +1 -2
  112. package/build/legacy/useQueries.d.cts +3 -5
  113. package/build/legacy/useQueries.d.cts.map +1 -1
  114. package/build/legacy/useQueries.d.ts +3 -5
  115. package/build/legacy/useQueries.d.ts.map +1 -1
  116. package/build/legacy/useQueries.js +1 -2
  117. package/build/legacy/useQuery.cjs +1 -2
  118. package/build/legacy/useQuery.cjs.map +1 -1
  119. package/build/legacy/useQuery.d.cts +11 -12
  120. package/build/legacy/useQuery.d.cts.map +1 -1
  121. package/build/legacy/useQuery.d.ts +11 -12
  122. package/build/legacy/useQuery.d.ts.map +1 -1
  123. package/build/legacy/useQuery.js +1 -2
  124. package/build/legacy/useQuery.js.map +1 -1
  125. package/build/legacy/useQueryClient.cjs +1 -2
  126. package/build/legacy/useQueryClient.d.cts +1 -3
  127. package/build/legacy/useQueryClient.d.cts.map +1 -1
  128. package/build/legacy/useQueryClient.d.ts +1 -3
  129. package/build/legacy/useQueryClient.d.ts.map +1 -1
  130. package/build/legacy/useQueryClient.js +1 -2
  131. package/build/legacy/utils.cjs +1 -2
  132. package/build/legacy/utils.d.cts +1 -3
  133. package/build/legacy/utils.d.cts.map +1 -1
  134. package/build/legacy/utils.d.ts +1 -3
  135. package/build/legacy/utils.d.ts.map +1 -1
  136. package/build/legacy/utils.js +1 -2
  137. package/build/legacy/vueQueryPlugin.cjs +1 -2
  138. package/build/legacy/vueQueryPlugin.d.cts +2 -4
  139. package/build/legacy/vueQueryPlugin.d.cts.map +1 -1
  140. package/build/legacy/vueQueryPlugin.d.ts +2 -4
  141. package/build/legacy/vueQueryPlugin.d.ts.map +1 -1
  142. package/build/legacy/vueQueryPlugin.js +1 -2
  143. package/build/modern/devtools/devtools.cjs +1 -2
  144. package/build/modern/devtools/devtools.d.cts +1 -3
  145. package/build/modern/devtools/devtools.d.cts.map +1 -1
  146. package/build/modern/devtools/devtools.d.ts +1 -3
  147. package/build/modern/devtools/devtools.d.ts.map +1 -1
  148. package/build/modern/devtools/devtools.js +1 -2
  149. package/build/modern/devtools/utils.cjs +1 -2
  150. package/build/modern/devtools/utils.d.cts +0 -2
  151. package/build/modern/devtools/utils.d.cts.map +1 -1
  152. package/build/modern/devtools/utils.d.ts +0 -2
  153. package/build/modern/devtools/utils.d.ts.map +1 -1
  154. package/build/modern/devtools/utils.js +1 -2
  155. package/build/modern/index.d.cts +4 -4
  156. package/build/modern/index.d.ts +4 -4
  157. package/build/modern/{infiniteQueryOptions-CoRGgnPB.d.ts → infiniteQueryOptions-BLGtkUwV.d.ts} +28 -33
  158. package/build/modern/infiniteQueryOptions-BLGtkUwV.d.ts.map +1 -0
  159. package/build/modern/{infiniteQueryOptions-BOLnyklt.d.cts → infiniteQueryOptions-oStzZOCq.d.cts} +28 -33
  160. package/build/modern/infiniteQueryOptions-oStzZOCq.d.cts.map +1 -0
  161. package/build/modern/infiniteQueryOptions.cjs +1 -2
  162. package/build/modern/infiniteQueryOptions.cjs.map +1 -1
  163. package/build/modern/infiniteQueryOptions.d.cts +1 -1
  164. package/build/modern/infiniteQueryOptions.d.ts +1 -1
  165. package/build/modern/infiniteQueryOptions.js +1 -2
  166. package/build/modern/infiniteQueryOptions.js.map +1 -1
  167. package/build/modern/mutationCache.cjs +1 -2
  168. package/build/modern/mutationCache.d.cts +1 -3
  169. package/build/modern/mutationCache.d.cts.map +1 -1
  170. package/build/modern/mutationCache.d.ts +1 -3
  171. package/build/modern/mutationCache.d.ts.map +1 -1
  172. package/build/modern/mutationCache.js +1 -2
  173. package/build/modern/mutationOptions.cjs +1 -2
  174. package/build/modern/mutationOptions.d.cts +1 -3
  175. package/build/modern/mutationOptions.d.cts.map +1 -1
  176. package/build/modern/mutationOptions.d.ts +1 -3
  177. package/build/modern/mutationOptions.d.ts.map +1 -1
  178. package/build/modern/mutationOptions.js +1 -2
  179. package/build/modern/queryCache.cjs +1 -2
  180. package/build/modern/queryCache.d.cts +1 -3
  181. package/build/modern/queryCache.d.cts.map +1 -1
  182. package/build/modern/queryCache.d.ts +1 -3
  183. package/build/modern/queryCache.d.ts.map +1 -1
  184. package/build/modern/queryCache.js +1 -2
  185. package/build/{legacy/queryClient-D4OU6h40.d.ts → modern/queryClient-CVne8UYf.d.ts} +4 -6
  186. package/build/modern/queryClient-CVne8UYf.d.ts.map +1 -0
  187. package/build/{legacy/queryClient-4Y1X98Y3.d.cts → modern/queryClient-DdZQqhoA.d.cts} +4 -6
  188. package/build/modern/queryClient-DdZQqhoA.d.cts.map +1 -0
  189. package/build/modern/queryClient.cjs +1 -2
  190. package/build/modern/queryClient.cjs.map +1 -1
  191. package/build/modern/queryClient.d.cts +1 -1
  192. package/build/modern/queryClient.d.ts +1 -1
  193. package/build/modern/queryClient.js +1 -2
  194. package/build/modern/queryClient.js.map +1 -1
  195. package/build/{legacy/queryOptions-gpn5D4rf.d.ts → modern/queryOptions-BuZEBLtg.d.cts} +16 -16
  196. package/build/modern/queryOptions-BuZEBLtg.d.cts.map +1 -0
  197. package/build/{legacy/queryOptions-BvmZtmiU.d.cts → modern/queryOptions-dXiBZnGk.d.ts} +16 -16
  198. package/build/modern/queryOptions-dXiBZnGk.d.ts.map +1 -0
  199. package/build/modern/queryOptions.cjs +1 -2
  200. package/build/modern/queryOptions.cjs.map +1 -1
  201. package/build/modern/queryOptions.d.cts +1 -1
  202. package/build/modern/queryOptions.d.ts +1 -1
  203. package/build/modern/queryOptions.js +1 -2
  204. package/build/modern/queryOptions.js.map +1 -1
  205. package/build/{legacy/types-sdZdiLgo.d.cts → modern/types-u_Tu5Ybs.d.cts} +1 -3
  206. package/build/modern/{types-sdZdiLgo.d.ts.map → types-u_Tu5Ybs.d.cts.map} +1 -1
  207. package/build/modern/{types-sdZdiLgo.d.cts → types-u_Tu5Ybs.d.ts} +1 -3
  208. package/build/modern/types-u_Tu5Ybs.d.ts.map +1 -0
  209. package/build/modern/types.d.cts +1 -1
  210. package/build/modern/types.d.ts +1 -1
  211. package/build/modern/useBaseQuery.cjs +1 -2
  212. package/build/modern/useBaseQuery.d.cts +1 -1
  213. package/build/modern/useBaseQuery.d.ts +1 -1
  214. package/build/modern/useBaseQuery.js +1 -2
  215. package/build/modern/useInfiniteQuery.cjs +1 -2
  216. package/build/modern/useInfiniteQuery.cjs.map +1 -1
  217. package/build/modern/useInfiniteQuery.d.cts +1 -1
  218. package/build/modern/useInfiniteQuery.d.ts +1 -1
  219. package/build/modern/useInfiniteQuery.js +1 -2
  220. package/build/modern/useInfiniteQuery.js.map +1 -1
  221. package/build/modern/useIsFetching.cjs +1 -2
  222. package/build/modern/useIsFetching.cjs.map +1 -1
  223. package/build/modern/useIsFetching.d.cts +3 -5
  224. package/build/modern/useIsFetching.d.cts.map +1 -1
  225. package/build/modern/useIsFetching.d.ts +3 -5
  226. package/build/modern/useIsFetching.d.ts.map +1 -1
  227. package/build/modern/useIsFetching.js +1 -2
  228. package/build/modern/useIsFetching.js.map +1 -1
  229. package/build/modern/useMutation.cjs +1 -2
  230. package/build/modern/useMutation.d.cts +2 -4
  231. package/build/modern/useMutation.d.cts.map +1 -1
  232. package/build/modern/useMutation.d.ts +2 -4
  233. package/build/modern/useMutation.d.ts.map +1 -1
  234. package/build/modern/useMutation.js +1 -2
  235. package/build/modern/useMutationState.cjs +1 -2
  236. package/build/modern/useMutationState.d.cts +2 -4
  237. package/build/modern/useMutationState.d.cts.map +1 -1
  238. package/build/modern/useMutationState.d.ts +2 -4
  239. package/build/modern/useMutationState.d.ts.map +1 -1
  240. package/build/modern/useMutationState.js +1 -2
  241. package/build/modern/usePrefetchInfiniteQuery.cjs +1 -2
  242. package/build/modern/usePrefetchInfiniteQuery.d.cts +2 -4
  243. package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
  244. package/build/modern/usePrefetchInfiniteQuery.d.ts +2 -4
  245. package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
  246. package/build/modern/usePrefetchInfiniteQuery.js +1 -2
  247. package/build/modern/usePrefetchQuery.cjs +1 -2
  248. package/build/modern/usePrefetchQuery.d.cts +2 -4
  249. package/build/modern/usePrefetchQuery.d.cts.map +1 -1
  250. package/build/modern/usePrefetchQuery.d.ts +2 -4
  251. package/build/modern/usePrefetchQuery.d.ts.map +1 -1
  252. package/build/modern/usePrefetchQuery.js +1 -2
  253. package/build/modern/useQueries.cjs +1 -2
  254. package/build/modern/useQueries.d.cts +3 -5
  255. package/build/modern/useQueries.d.cts.map +1 -1
  256. package/build/modern/useQueries.d.ts +3 -5
  257. package/build/modern/useQueries.d.ts.map +1 -1
  258. package/build/modern/useQueries.js +1 -2
  259. package/build/modern/useQuery.cjs +1 -2
  260. package/build/modern/useQuery.cjs.map +1 -1
  261. package/build/modern/useQuery.d.cts +11 -12
  262. package/build/modern/useQuery.d.cts.map +1 -1
  263. package/build/modern/useQuery.d.ts +11 -12
  264. package/build/modern/useQuery.d.ts.map +1 -1
  265. package/build/modern/useQuery.js +1 -2
  266. package/build/modern/useQuery.js.map +1 -1
  267. package/build/modern/useQueryClient.cjs +1 -2
  268. package/build/modern/useQueryClient.d.cts +1 -3
  269. package/build/modern/useQueryClient.d.cts.map +1 -1
  270. package/build/modern/useQueryClient.d.ts +1 -3
  271. package/build/modern/useQueryClient.d.ts.map +1 -1
  272. package/build/modern/useQueryClient.js +1 -2
  273. package/build/modern/utils.cjs +1 -2
  274. package/build/modern/utils.d.cts +1 -3
  275. package/build/modern/utils.d.cts.map +1 -1
  276. package/build/modern/utils.d.ts +1 -3
  277. package/build/modern/utils.d.ts.map +1 -1
  278. package/build/modern/utils.js +1 -2
  279. package/build/modern/vueQueryPlugin.cjs +1 -2
  280. package/build/modern/vueQueryPlugin.d.cts +2 -4
  281. package/build/modern/vueQueryPlugin.d.cts.map +1 -1
  282. package/build/modern/vueQueryPlugin.d.ts +2 -4
  283. package/build/modern/vueQueryPlugin.d.ts.map +1 -1
  284. package/build/modern/vueQueryPlugin.js +1 -2
  285. package/package.json +2 -2
  286. package/src/infiniteQueryOptions.ts +28 -21
  287. package/src/queryClient.ts +3 -1
  288. package/src/queryOptions.ts +14 -12
  289. package/src/useInfiniteQuery.ts +3 -3
  290. package/src/useIsFetching.ts +2 -2
  291. package/src/useQuery.ts +7 -6
  292. package/build/legacy/infiniteQueryOptions-BOLnyklt.d.cts.map +0 -1
  293. package/build/legacy/infiniteQueryOptions-CoRGgnPB.d.ts.map +0 -1
  294. package/build/legacy/queryClient-4Y1X98Y3.d.cts.map +0 -1
  295. package/build/legacy/queryClient-D4OU6h40.d.ts.map +0 -1
  296. package/build/legacy/queryOptions-BvmZtmiU.d.cts.map +0 -1
  297. package/build/legacy/queryOptions-gpn5D4rf.d.ts.map +0 -1
  298. package/build/legacy/types-sdZdiLgo.d.cts.map +0 -1
  299. package/build/modern/infiniteQueryOptions-BOLnyklt.d.cts.map +0 -1
  300. package/build/modern/infiniteQueryOptions-CoRGgnPB.d.ts.map +0 -1
  301. package/build/modern/queryClient-4Y1X98Y3.d.cts.map +0 -1
  302. package/build/modern/queryClient-D4OU6h40.d.ts.map +0 -1
  303. package/build/modern/queryOptions-BvmZtmiU.d.cts.map +0 -1
  304. package/build/modern/queryOptions-gpn5D4rf.d.ts.map +0 -1
  305. package/build/modern/types-sdZdiLgo.d.cts.map +0 -1
@@ -1,6 +1,5 @@
1
- import { a as MaybeRef, d as ShallowOption, o as MaybeRefDeep, s as MaybeRefOrGetter, t as DeepUnwrapRef } from "./types-sdZdiLgo.js";
1
+ import { a as MaybeRef, d as ShallowOption, o as MaybeRefDeep, s as MaybeRefOrGetter, t as DeepUnwrapRef } from "./types-u_Tu5Ybs.cjs";
2
2
  import { DefaultError, InitialDataFunction, NonUndefinedGuard, QueryBooleanOption, QueryKey, QueryKeyWithDataTag, QueryObserverOptions } from "@tanstack/query-core";
3
- //#region src/queryOptions.d.ts
4
3
  /**
5
4
  * The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the
6
5
  * `queryClient` methods see once `ref`s have been resolved. To pass options in, use
@@ -60,8 +59,9 @@ type WithDefinedInitialData<TQueryFnData> = {
60
59
  initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
61
60
  };
62
61
  /**
63
- * The options accepted by the `queryOptions` overload selected when no `initialData` is set — `data` may be
64
- * `undefined` while the query is `pending`.
62
+ * The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be
63
+ * `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
64
+ * `pending`.
65
65
  * @template TQueryFnData - The type your `queryFn` resolves to.
66
66
  * @template TError - The type of errors your `queryFn` may throw.
67
67
  * @template TData - The type `data` ends up as after `select` runs.
@@ -69,8 +69,8 @@ type WithDefinedInitialData<TQueryFnData> = {
69
69
  */
70
70
  type UndefinedInitialQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithUndefinedInitialData<TQueryFnData>;
71
71
  /**
72
- * The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never
73
- * `undefined` (unless a `select` changes `TData` to include `undefined`).
72
+ * The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —
73
+ * `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
74
74
  * @template TQueryFnData - The type your `queryFn` resolves to.
75
75
  * @template TError - The type of errors your `queryFn` may throw.
76
76
  * @template TData - The type `data` ends up as after `select` runs.
@@ -78,13 +78,14 @@ type UndefinedInitialQueryOptions<TQueryFnData = unknown, TError = DefaultError,
78
78
  */
79
79
  type DefinedInitialQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithDefinedInitialData<TQueryFnData>;
80
80
  /**
81
- * The options returned by the `queryOptions` overload selected when `initialData` is omitted or may be
82
- * `undefined`, with the `queryKey` tagged with the query's data and error types.
81
+ * The options returned by the `queryOptions` overload selected when `initialData` is omitted, may be
82
+ * `undefined`, or is a function that may return `undefined`, with the `queryKey` tagged with the query's data
83
+ * and error types.
83
84
  */
84
85
  type UndefinedInitialQueryOptionsWithDataTag<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithUndefinedInitialData<TQueryFnData> & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
85
86
  /**
86
- * The options returned by the `queryOptions` overload selected when `initialData` is set, with the
87
- * `queryKey` tagged with the query's data and error types.
87
+ * The options returned by the `queryOptions` overload selected when `initialData` is known to be defined,
88
+ * with the `queryKey` tagged with the query's data and error types.
88
89
  */
89
90
  type DefinedInitialQueryOptionsWithDataTag<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithDefinedInitialData<TQueryFnData> & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
90
91
  /**
@@ -92,10 +93,10 @@ type DefinedInitialQueryOptionsWithDataTag<TQueryFnData = unknown, TError = Defa
92
93
  * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and
93
94
  * is the query key to generate options for.
94
95
  *
95
- * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
96
- * a `select` changes `TData` to include `undefined`).
97
- * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`, with
98
- * `initialData` set.
96
+ * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
97
+ * `undefined` (unless a `select` changes `TData` to include `undefined`).
98
+ * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`,
99
+ * with `initialData` known to be defined.
99
100
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
100
101
  * @see {@link useQuery} to run a query with these options.
101
102
  * @example
@@ -218,6 +219,5 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
218
219
  * ```
219
220
  */
220
221
  declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: () => UndefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>): () => UndefinedInitialQueryOptionsWithDataTag<TQueryFnData, TError, TData, TQueryKey>;
221
- //#endregion
222
222
  export { UndefinedInitialQueryOptionsWithDataTag as a, UndefinedInitialQueryOptions as i, DefinedInitialQueryOptionsWithDataTag as n, UseQueryOptions as o, QueryOptions as r, queryOptions as s, DefinedInitialQueryOptions as t };
223
- //# sourceMappingURL=queryOptions-gpn5D4rf.d.ts.map
223
+ //# sourceMappingURL=queryOptions-BuZEBLtg.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryOptions-BuZEBLtg.d.cts","names":[],"sources":["../../src/queryOptions.ts"],"mappings":";;;;;;;;;;;;;KA4BY,aACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,eAG3B,kBAAkB,qBAChB,cACA,QACA,OACA,YACA,aAED,6BAEK,+CACO,mBACL,cACA,QACA,YACA,cAAc,eAEpB,8BACE,iBAAiB,aACjB,qBACE,cACA,QACA,OACA,YACA,cAAc,YACd,eACN;KAGC;;;;;;;;;;;;;;;;;;;;;;;;;KA0BO,gBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,YAGE,kBAAkB,qBAChB,cACA,QACA,OACA,YACA,aAED,0CACC,aACE,cACA,QACA,OACA,YACA,WACA,YACF,6BACE,aACI,aACE,cACA,QACA,OACA,YACA,WACA,YACF,wBAEJ,aACE,aACE,cACA,QACA,OACA,YACA,WACA,gBAER;KAGD,yBAAyB;;;;;;;;EAQ5B,0BAEI,oBAAoB,kBAAkB,iBACtC,kBAAkB;;KAGnB,uBAAuB;;;;;;;;EAQ1B,aACI,kBAAkB,uBACX,kBAAkB;;;;;;;;;;;KAYnB,6BACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,gBAAgB,cAAc,QAAQ,OAAO,cAAc,aAC7D,yBAAyB;;;;;;;;;KAUf,2BACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,gBAAgB,cAAc,QAAQ,OAAO,cAAc,aAC7D,uBAAuB;;;;;;KAOb,wCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,aAAa,cAAc,QAAQ,OAAO,cAAc,aAC1D,yBAAyB,gBACzB,oBAAoB,WAAW,cAAc;;;;;KAMnC,sCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,aAAa,cAAc,QAAQ,OAAO,cAAc,aAC1D,uBAAuB,gBACvB,oBAAoB,WAAW,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8B/B,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,SAAS,2BAA2B,cAAc,QAAQ,OAAO,aAChE,sCAAsC,cAAc,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BtD,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,eAAe,2BACb,cACA,QACA,OACA,mBAEK,sCACP,cACA,QACA,OACA;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,SAAS,6BAA6B,cAAc,QAAQ,OAAO,aAClE,wCACD,cACA,QACA,OACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoDc,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,eAAe,6BACb,cACA,QACA,OACA,mBAEK,wCACP,cACA,QACA,OACA"}
@@ -1,6 +1,5 @@
1
- import { a as MaybeRef, d as ShallowOption, o as MaybeRefDeep, s as MaybeRefOrGetter, t as DeepUnwrapRef } from "./types-sdZdiLgo.cjs";
1
+ import { a as MaybeRef, d as ShallowOption, o as MaybeRefDeep, s as MaybeRefOrGetter, t as DeepUnwrapRef } from "./types-u_Tu5Ybs.js";
2
2
  import { DefaultError, InitialDataFunction, NonUndefinedGuard, QueryBooleanOption, QueryKey, QueryKeyWithDataTag, QueryObserverOptions } from "@tanstack/query-core";
3
- //#region src/queryOptions.d.ts
4
3
  /**
5
4
  * The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the
6
5
  * `queryClient` methods see once `ref`s have been resolved. To pass options in, use
@@ -60,8 +59,9 @@ type WithDefinedInitialData<TQueryFnData> = {
60
59
  initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
61
60
  };
62
61
  /**
63
- * The options accepted by the `queryOptions` overload selected when no `initialData` is set — `data` may be
64
- * `undefined` while the query is `pending`.
62
+ * The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be
63
+ * `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is
64
+ * `pending`.
65
65
  * @template TQueryFnData - The type your `queryFn` resolves to.
66
66
  * @template TError - The type of errors your `queryFn` may throw.
67
67
  * @template TData - The type `data` ends up as after `select` runs.
@@ -69,8 +69,8 @@ type WithDefinedInitialData<TQueryFnData> = {
69
69
  */
70
70
  type UndefinedInitialQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithUndefinedInitialData<TQueryFnData>;
71
71
  /**
72
- * The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never
73
- * `undefined` (unless a `select` changes `TData` to include `undefined`).
72
+ * The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —
73
+ * `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).
74
74
  * @template TQueryFnData - The type your `queryFn` resolves to.
75
75
  * @template TError - The type of errors your `queryFn` may throw.
76
76
  * @template TData - The type `data` ends up as after `select` runs.
@@ -78,13 +78,14 @@ type UndefinedInitialQueryOptions<TQueryFnData = unknown, TError = DefaultError,
78
78
  */
79
79
  type DefinedInitialQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithDefinedInitialData<TQueryFnData>;
80
80
  /**
81
- * The options returned by the `queryOptions` overload selected when `initialData` is omitted or may be
82
- * `undefined`, with the `queryKey` tagged with the query's data and error types.
81
+ * The options returned by the `queryOptions` overload selected when `initialData` is omitted, may be
82
+ * `undefined`, or is a function that may return `undefined`, with the `queryKey` tagged with the query's data
83
+ * and error types.
83
84
  */
84
85
  type UndefinedInitialQueryOptionsWithDataTag<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithUndefinedInitialData<TQueryFnData> & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
85
86
  /**
86
- * The options returned by the `queryOptions` overload selected when `initialData` is set, with the
87
- * `queryKey` tagged with the query's data and error types.
87
+ * The options returned by the `queryOptions` overload selected when `initialData` is known to be defined,
88
+ * with the `queryKey` tagged with the query's data and error types.
88
89
  */
89
90
  type DefinedInitialQueryOptionsWithDataTag<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> & WithDefinedInitialData<TQueryFnData> & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
90
91
  /**
@@ -92,10 +93,10 @@ type DefinedInitialQueryOptionsWithDataTag<TQueryFnData = unknown, TError = Defa
92
93
  * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and
93
94
  * is the query key to generate options for.
94
95
  *
95
- * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
96
- * a `select` changes `TData` to include `undefined`).
97
- * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`, with
98
- * `initialData` set.
96
+ * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
97
+ * `undefined` (unless a `select` changes `TData` to include `undefined`).
98
+ * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`,
99
+ * with `initialData` known to be defined.
99
100
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
100
101
  * @see {@link useQuery} to run a query with these options.
101
102
  * @example
@@ -218,6 +219,5 @@ declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TDa
218
219
  * ```
219
220
  */
220
221
  declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: () => UndefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>): () => UndefinedInitialQueryOptionsWithDataTag<TQueryFnData, TError, TData, TQueryKey>;
221
- //#endregion
222
222
  export { UndefinedInitialQueryOptionsWithDataTag as a, UndefinedInitialQueryOptions as i, DefinedInitialQueryOptionsWithDataTag as n, UseQueryOptions as o, QueryOptions as r, queryOptions as s, DefinedInitialQueryOptions as t };
223
- //# sourceMappingURL=queryOptions-BvmZtmiU.d.cts.map
223
+ //# sourceMappingURL=queryOptions-dXiBZnGk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryOptions-dXiBZnGk.d.ts","names":[],"sources":["../../src/queryOptions.ts"],"mappings":";;;;;;;;;;;;;KA4BY,aACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,eAG3B,kBAAkB,qBAChB,cACA,QACA,OACA,YACA,aAED,6BAEK,+CACO,mBACL,cACA,QACA,YACA,cAAc,eAEpB,8BACE,iBAAiB,aACjB,qBACE,cACA,QACA,OACA,YACA,cAAc,YACd,eACN;KAGC;;;;;;;;;;;;;;;;;;;;;;;;;KA0BO,gBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,YAGE,kBAAkB,qBAChB,cACA,QACA,OACA,YACA,aAED,0CACC,aACE,cACA,QACA,OACA,YACA,WACA,YACF,6BACE,aACI,aACE,cACA,QACA,OACA,YACA,WACA,YACF,wBAEJ,aACE,aACE,cACA,QACA,OACA,YACA,WACA,gBAER;KAGD,yBAAyB;;;;;;;;EAQ5B,0BAEI,oBAAoB,kBAAkB,iBACtC,kBAAkB;;KAGnB,uBAAuB;;;;;;;;EAQ1B,aACI,kBAAkB,uBACX,kBAAkB;;;;;;;;;;;KAYnB,6BACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,gBAAgB,cAAc,QAAQ,OAAO,cAAc,aAC7D,yBAAyB;;;;;;;;;KAUf,2BACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,gBAAgB,cAAc,QAAQ,OAAO,cAAc,aAC7D,uBAAuB;;;;;;KAOb,wCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,aAAa,cAAc,QAAQ,OAAO,cAAc,aAC1D,yBAAyB,gBACzB,oBAAoB,WAAW,cAAc;;;;;KAMnC,sCACV,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,YAC3B,aAAa,cAAc,QAAQ,OAAO,cAAc,aAC1D,uBAAuB,gBACvB,oBAAoB,WAAW,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8B/B,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,SAAS,2BAA2B,cAAc,QAAQ,OAAO,aAChE,sCAAsC,cAAc,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BtD,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,eAAe,2BACb,cACA,QACA,OACA,mBAEK,sCACP,cACA,QACA,OACA;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,SAAS,6BAA6B,cAAc,QAAQ,OAAO,aAClE,wCACD,cACA,QACA,OACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoDc,aACd,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,eAAe,6BACb,cACA,QACA,OACA,mBAEK,wCACP,cACA,QACA,OACA"}
@@ -1,9 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/queryOptions.ts
2
+ // src/queryOptions.ts
3
3
  function queryOptions(options) {
4
4
  return options;
5
5
  }
6
- //#endregion
7
6
  exports.queryOptions = queryOptions;
8
7
 
9
8
  //# sourceMappingURL=queryOptions.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryOptions.cjs","names":[],"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type {\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n QueryBooleanOption,\n QueryKey,\n QueryKeyWithDataTag,\n QueryObserverOptions,\n} from '@tanstack/query-core'\n\n/**\n * The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the\n * `queryClient` methods see once `ref`s have been resolved. To pass options in, use\n * {@link UseQueryOptions}, which accepts the same options as `ref`s and `computed`s too.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type QueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled'\n ?\n | MaybeRefOrGetter<boolean | undefined>\n | (() => QueryBooleanOption<\n TQueryFnData,\n TError,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >)\n : Property extends 'queryKey'\n ? MaybeRefOrGetter<TQueryKey>\n : QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >[Property]\n} & ShallowOption\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQuery = symbol\n\n/**\n * The options accepted by `queryOptions`, `useQuery`, and the other query hooks. `enabled` tracks reactive\n * dependencies automatically as a `ref`, a plain value, or a reactive getter (`() => ...`). `queryKey` reacts\n * through a `ref` or a reactive getter for the array itself, or `ref`s and reactive getters as individual\n * entries. Other options are read once when passed as a plain value, and stay reactive when passed as a `ref`\n * or a `computed`. Only `enabled` and `queryKey` read a function as a getter, so `queryFn` reacts through a\n * `computed`: a function there is the query function itself.\n *\n * If you instead pass a getter for the whole options object (`useQuery(() => ({ ... }))`), every option\n * inside it — including `staleTime`, `retry`, and `select` — is re-evaluated whenever the getter's own\n * reactive dependencies change, since the entire object is recomputed.\n *\n * `select` only re-runs when `data` changes, or when the `select` function's own reference changes. Since a\n * Vue `setup()` function runs only once per component instance, an inline `select` function passed directly\n * to `queryOptions`/`useQuery` already has a stable reference across reactive updates. An inline `select`\n * created inside a whole-options getter is recreated — and so can change reference — every time that getter\n * re-evaluates.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = MaybeRef<\n {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled' | 'queryKey'\n ? QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n : Property extends 'queryFn'\n ? MaybeRefDeep<\n | QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n | SkipTokenForUseQuery\n >\n : MaybeRefDeep<\n QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n >\n } & ShallowOption\n>\n\ntype WithUndefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\ntype WithDefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n}\n\n/**\n * The options accepted by the `queryOptions` overload selected when no `initialData` is set — `data` may be\n * `undefined` while the query is `pending`.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UndefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData>\n\n/**\n * The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type DefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is omitted or may be\n * `undefined`, with the `queryKey` tagged with the query's data and error types.\n */\nexport type UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is set, with the\n * `queryKey` tagged with the query's data and error types.\n */\nexport type DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n *\n * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless\n * a `select` changes `TData` to include `undefined`).\n * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`, with\n * `initialData` set.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postsOptions = queryOptions({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * initialData: [],\n * })\n *\n * // `data` is `Post[]`, never `undefined`, thanks to `initialData` — even if a refetch fails,\n * // so the list stays visible alongside the error.\n * const { data, isError, error } = useQuery(postsOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialQueryOptionsWithDataTag<TQueryFnData, TError, TData, TQueryKey>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so `queryClient` methods like `invalidateQueries`/`fetchQuery` always\n * read the current values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link DefinedInitialQueryOptions} to use, re-evaluated on demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred data\n * type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * initialData: { id: postId.value, title: '' },\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => DefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n * @param options - The {@link UndefinedInitialQueryOptions} to use — everything you can pass to `useQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(id: string) {\n * return queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n * }\n *\n * const { data, isPending, isError, error } = useQuery(postOptions('1'))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so the `queryKey` — and anything else derived from a `ref` — reacts\n * to changes, and so `queryClient` methods like `invalidateQueries`/`fetchQuery` always read the current\n * values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link UndefinedInitialQueryOptions} to use, re-evaluated on\n * demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred\n * data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery, useQueryClient } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * const queryClient = useQueryClient()\n * // Here, call `postOptions()` so `invalidateQueries` reads the current `queryKey` right away.\n * queryClient.invalidateQueries(postOptions())\n * </script>\n * ```\n * @example\n * A parameterized factory that disables the query, type safe, until `postId` is set. The whole-options getter\n * re-evaluates `queryFn` on every change to `postId`. `queryFn` can also be a `computed`, but never a bare\n * getter, since a function there is the query function itself:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, skipToken, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(postId: number | undefined) {\n * return queryOptions(() => ({\n * queryKey: ['post', postId],\n * queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n * }))\n * }\n *\n * const props = defineProps<{ postId: number | undefined }>()\n * const { data, isLoading, isError, error } = useQuery(postOptions(props.postId))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => UndefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;AA0ZA,SAAgB,aAAa,SAAkB;CAC7C,OAAO;AACT"}
1
+ {"version":3,"file":"queryOptions.cjs","names":[],"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type {\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n QueryBooleanOption,\n QueryKey,\n QueryKeyWithDataTag,\n QueryObserverOptions,\n} from '@tanstack/query-core'\n\n/**\n * The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the\n * `queryClient` methods see once `ref`s have been resolved. To pass options in, use\n * {@link UseQueryOptions}, which accepts the same options as `ref`s and `computed`s too.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type QueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled'\n ?\n | MaybeRefOrGetter<boolean | undefined>\n | (() => QueryBooleanOption<\n TQueryFnData,\n TError,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >)\n : Property extends 'queryKey'\n ? MaybeRefOrGetter<TQueryKey>\n : QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >[Property]\n} & ShallowOption\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQuery = symbol\n\n/**\n * The options accepted by `queryOptions`, `useQuery`, and the other query hooks. `enabled` tracks reactive\n * dependencies automatically as a `ref`, a plain value, or a reactive getter (`() => ...`). `queryKey` reacts\n * through a `ref` or a reactive getter for the array itself, or `ref`s and reactive getters as individual\n * entries. Other options are read once when passed as a plain value, and stay reactive when passed as a `ref`\n * or a `computed`. Only `enabled` and `queryKey` read a function as a getter, so `queryFn` reacts through a\n * `computed`: a function there is the query function itself.\n *\n * If you instead pass a getter for the whole options object (`useQuery(() => ({ ... }))`), every option\n * inside it — including `staleTime`, `retry`, and `select` — is re-evaluated whenever the getter's own\n * reactive dependencies change, since the entire object is recomputed.\n *\n * `select` only re-runs when `data` changes, or when the `select` function's own reference changes. Since a\n * Vue `setup()` function runs only once per component instance, an inline `select` function passed directly\n * to `queryOptions`/`useQuery` already has a stable reference across reactive updates. An inline `select`\n * created inside a whole-options getter is recreated — and so can change reference — every time that getter\n * re-evaluates.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = MaybeRef<\n {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled' | 'queryKey'\n ? QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n : Property extends 'queryFn'\n ? MaybeRefDeep<\n | QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n | SkipTokenForUseQuery\n >\n : MaybeRefDeep<\n QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n >\n } & ShallowOption\n>\n\ntype WithUndefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\ntype WithDefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n}\n\n/**\n * The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be\n * `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is\n * `pending`.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UndefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData>\n\n/**\n * The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —\n * `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type DefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is omitted, may be\n * `undefined`, or is a function that may return `undefined`, with the `queryKey` tagged with the query's data\n * and error types.\n */\nexport type UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is known to be defined,\n * with the `queryKey` tagged with the query's data and error types.\n */\nexport type DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n *\n * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`,\n * with `initialData` known to be defined.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postsOptions = queryOptions({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * initialData: [],\n * })\n *\n * // `data` is `Post[]`, never `undefined`, thanks to `initialData` — even if a refetch fails,\n * // so the list stays visible alongside the error.\n * const { data, isError, error } = useQuery(postsOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialQueryOptionsWithDataTag<TQueryFnData, TError, TData, TQueryKey>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so `queryClient` methods like `invalidateQueries`/`fetchQuery` always\n * read the current values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link DefinedInitialQueryOptions} to use, re-evaluated on demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred data\n * type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * initialData: { id: postId.value, title: '' },\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => DefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n * @param options - The {@link UndefinedInitialQueryOptions} to use — everything you can pass to `useQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(id: string) {\n * return queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n * }\n *\n * const { data, isPending, isError, error } = useQuery(postOptions('1'))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so the `queryKey` — and anything else derived from a `ref` — reacts\n * to changes, and so `queryClient` methods like `invalidateQueries`/`fetchQuery` always read the current\n * values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link UndefinedInitialQueryOptions} to use, re-evaluated on\n * demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred\n * data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery, useQueryClient } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * const queryClient = useQueryClient()\n * // Here, call `postOptions()` so `invalidateQueries` reads the current `queryKey` right away.\n * queryClient.invalidateQueries(postOptions())\n * </script>\n * ```\n * @example\n * A parameterized factory that disables the query, type safe, until `postId` is set. The whole-options getter\n * re-evaluates `queryFn` on every change to `postId`. `queryFn` can also be a `computed`, but never a bare\n * getter, since a function there is the query function itself:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, skipToken, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(postId: number | undefined) {\n * return queryOptions(() => ({\n * queryKey: ['post', postId],\n * queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n * }))\n * }\n *\n * const props = defineProps<{ postId: number | undefined }>()\n * const { data, isLoading, isError, error } = useQuery(postOptions(props.postId))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => UndefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;AA4ZA,SAAgB,aAAa,SAAkB;CAC7C,OAAO;AACT"}
@@ -1,2 +1,2 @@
1
- import { a as UndefinedInitialQueryOptionsWithDataTag, i as UndefinedInitialQueryOptions, n as DefinedInitialQueryOptionsWithDataTag, o as UseQueryOptions, r as QueryOptions, s as queryOptions, t as DefinedInitialQueryOptions } from "./queryOptions-BvmZtmiU.cjs";
1
+ import { a as UndefinedInitialQueryOptionsWithDataTag, i as UndefinedInitialQueryOptions, n as DefinedInitialQueryOptionsWithDataTag, o as UseQueryOptions, r as QueryOptions, s as queryOptions, t as DefinedInitialQueryOptions } from "./queryOptions-BuZEBLtg.cjs";
2
2
  export { DefinedInitialQueryOptions, DefinedInitialQueryOptionsWithDataTag, QueryOptions, UndefinedInitialQueryOptions, UndefinedInitialQueryOptionsWithDataTag, UseQueryOptions, queryOptions };
@@ -1,2 +1,2 @@
1
- import { a as UndefinedInitialQueryOptionsWithDataTag, i as UndefinedInitialQueryOptions, n as DefinedInitialQueryOptionsWithDataTag, o as UseQueryOptions, r as QueryOptions, s as queryOptions, t as DefinedInitialQueryOptions } from "./queryOptions-gpn5D4rf.js";
1
+ import { a as UndefinedInitialQueryOptionsWithDataTag, i as UndefinedInitialQueryOptions, n as DefinedInitialQueryOptionsWithDataTag, o as UseQueryOptions, r as QueryOptions, s as queryOptions, t as DefinedInitialQueryOptions } from "./queryOptions-dXiBZnGk.js";
2
2
  export { DefinedInitialQueryOptions, DefinedInitialQueryOptionsWithDataTag, QueryOptions, UndefinedInitialQueryOptions, UndefinedInitialQueryOptionsWithDataTag, UseQueryOptions, queryOptions };
@@ -1,8 +1,7 @@
1
- //#region src/queryOptions.ts
1
+ // src/queryOptions.ts
2
2
  function queryOptions(options) {
3
3
  return options;
4
4
  }
5
- //#endregion
6
5
  export { queryOptions };
7
6
 
8
7
  //# sourceMappingURL=queryOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryOptions.js","names":[],"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type {\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n QueryBooleanOption,\n QueryKey,\n QueryKeyWithDataTag,\n QueryObserverOptions,\n} from '@tanstack/query-core'\n\n/**\n * The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the\n * `queryClient` methods see once `ref`s have been resolved. To pass options in, use\n * {@link UseQueryOptions}, which accepts the same options as `ref`s and `computed`s too.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type QueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled'\n ?\n | MaybeRefOrGetter<boolean | undefined>\n | (() => QueryBooleanOption<\n TQueryFnData,\n TError,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >)\n : Property extends 'queryKey'\n ? MaybeRefOrGetter<TQueryKey>\n : QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >[Property]\n} & ShallowOption\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQuery = symbol\n\n/**\n * The options accepted by `queryOptions`, `useQuery`, and the other query hooks. `enabled` tracks reactive\n * dependencies automatically as a `ref`, a plain value, or a reactive getter (`() => ...`). `queryKey` reacts\n * through a `ref` or a reactive getter for the array itself, or `ref`s and reactive getters as individual\n * entries. Other options are read once when passed as a plain value, and stay reactive when passed as a `ref`\n * or a `computed`. Only `enabled` and `queryKey` read a function as a getter, so `queryFn` reacts through a\n * `computed`: a function there is the query function itself.\n *\n * If you instead pass a getter for the whole options object (`useQuery(() => ({ ... }))`), every option\n * inside it — including `staleTime`, `retry`, and `select` — is re-evaluated whenever the getter's own\n * reactive dependencies change, since the entire object is recomputed.\n *\n * `select` only re-runs when `data` changes, or when the `select` function's own reference changes. Since a\n * Vue `setup()` function runs only once per component instance, an inline `select` function passed directly\n * to `queryOptions`/`useQuery` already has a stable reference across reactive updates. An inline `select`\n * created inside a whole-options getter is recreated — and so can change reference — every time that getter\n * re-evaluates.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = MaybeRef<\n {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled' | 'queryKey'\n ? QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n : Property extends 'queryFn'\n ? MaybeRefDeep<\n | QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n | SkipTokenForUseQuery\n >\n : MaybeRefDeep<\n QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n >\n } & ShallowOption\n>\n\ntype WithUndefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\ntype WithDefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n}\n\n/**\n * The options accepted by the `queryOptions` overload selected when no `initialData` is set — `data` may be\n * `undefined` while the query is `pending`.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UndefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData>\n\n/**\n * The options accepted by the `queryOptions` overload selected when `initialData` is set — `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type DefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is omitted or may be\n * `undefined`, with the `queryKey` tagged with the query's data and error types.\n */\nexport type UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is set, with the\n * `queryKey` tagged with the query's data and error types.\n */\nexport type DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n *\n * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless\n * a `select` changes `TData` to include `undefined`).\n * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`, with\n * `initialData` set.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postsOptions = queryOptions({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * initialData: [],\n * })\n *\n * // `data` is `Post[]`, never `undefined`, thanks to `initialData` — even if a refetch fails,\n * // so the list stays visible alongside the error.\n * const { data, isError, error } = useQuery(postsOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialQueryOptionsWithDataTag<TQueryFnData, TError, TData, TQueryKey>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so `queryClient` methods like `invalidateQueries`/`fetchQuery` always\n * read the current values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link DefinedInitialQueryOptions} to use, re-evaluated on demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred data\n * type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * initialData: { id: postId.value, title: '' },\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => DefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n * @param options - The {@link UndefinedInitialQueryOptions} to use — everything you can pass to `useQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(id: string) {\n * return queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n * }\n *\n * const { data, isPending, isError, error } = useQuery(postOptions('1'))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so the `queryKey` — and anything else derived from a `ref` — reacts\n * to changes, and so `queryClient` methods like `invalidateQueries`/`fetchQuery` always read the current\n * values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link UndefinedInitialQueryOptions} to use, re-evaluated on\n * demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred\n * data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery, useQueryClient } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * const queryClient = useQueryClient()\n * // Here, call `postOptions()` so `invalidateQueries` reads the current `queryKey` right away.\n * queryClient.invalidateQueries(postOptions())\n * </script>\n * ```\n * @example\n * A parameterized factory that disables the query, type safe, until `postId` is set. The whole-options getter\n * re-evaluates `queryFn` on every change to `postId`. `queryFn` can also be a `computed`, but never a bare\n * getter, since a function there is the query function itself:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, skipToken, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(postId: number | undefined) {\n * return queryOptions(() => ({\n * queryKey: ['post', postId],\n * queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n * }))\n * }\n *\n * const props = defineProps<{ postId: number | undefined }>()\n * const { data, isLoading, isError, error } = useQuery(postOptions(props.postId))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => UndefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AA0ZA,SAAgB,aAAa,SAAkB;CAC7C,OAAO;AACT"}
1
+ {"version":3,"file":"queryOptions.js","names":[],"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type {\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n QueryBooleanOption,\n QueryKey,\n QueryKeyWithDataTag,\n QueryObserverOptions,\n} from '@tanstack/query-core'\n\n/**\n * The plain, unwrapped options that `queryOptions` hands back, and what `useQuery`, `useQueries`, and the\n * `queryClient` methods see once `ref`s have been resolved. To pass options in, use\n * {@link UseQueryOptions}, which accepts the same options as `ref`s and `computed`s too.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type QueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled'\n ?\n | MaybeRefOrGetter<boolean | undefined>\n | (() => QueryBooleanOption<\n TQueryFnData,\n TError,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >)\n : Property extends 'queryKey'\n ? MaybeRefOrGetter<TQueryKey>\n : QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n DeepUnwrapRef<TQueryKey>\n >[Property]\n} & ShallowOption\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQuery = symbol\n\n/**\n * The options accepted by `queryOptions`, `useQuery`, and the other query hooks. `enabled` tracks reactive\n * dependencies automatically as a `ref`, a plain value, or a reactive getter (`() => ...`). `queryKey` reacts\n * through a `ref` or a reactive getter for the array itself, or `ref`s and reactive getters as individual\n * entries. Other options are read once when passed as a plain value, and stay reactive when passed as a `ref`\n * or a `computed`. Only `enabled` and `queryKey` read a function as a getter, so `queryFn` reacts through a\n * `computed`: a function there is the query function itself.\n *\n * If you instead pass a getter for the whole options object (`useQuery(() => ({ ... }))`), every option\n * inside it — including `staleTime`, `retry`, and `select` — is re-evaluated whenever the getter's own\n * reactive dependencies change, since the entire object is recomputed.\n *\n * `select` only re-runs when `data` changes, or when the `select` function's own reference changes. Since a\n * Vue `setup()` function runs only once per component instance, an inline `select` function passed directly\n * to `queryOptions`/`useQuery` already has a stable reference across reactive updates. An inline `select`\n * created inside a whole-options getter is recreated — and so can change reference — every time that getter\n * re-evaluates.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryData - The type of data stored in the cache, before `select` runs. Defaults to\n * `TQueryFnData` and can be configured independently of it.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = MaybeRef<\n {\n [\n Property in keyof QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n ]: Property extends 'enabled' | 'queryKey'\n ? QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n : Property extends 'queryFn'\n ? MaybeRefDeep<\n | QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n | SkipTokenForUseQuery\n >\n : MaybeRefDeep<\n QueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >[Property]\n >\n } & ShallowOption\n>\n\ntype WithUndefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\ntype WithDefinedInitialData<TQueryFnData> = {\n /**\n * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been\n * created or cached yet). If set to a function, the function will be called **once** during the shared/root\n * query initialization, and be expected to synchronously return the initial data. Initial data is\n * considered stale by default unless a `staleTime` has been set. `initialData` **is persisted** to the\n * cache. Unlike `queryKey`/`enabled`, this is not reactive — it isn't re-evaluated on `ref` changes.\n */\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n}\n\n/**\n * The options accepted by the `queryOptions` overload selected when `initialData` is omitted, may be\n * `undefined`, or is a function that may return `undefined` — `data` may be `undefined` while the query is\n * `pending`.\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type UndefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData>\n\n/**\n * The options accepted by the `queryOptions` overload selected when `initialData` is known to be defined —\n * `data` is never `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @template TQueryFnData - The type your `queryFn` resolves to.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs.\n * @template TQueryKey - The type of your `queryKey`.\n */\nexport type DefinedInitialQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is omitted, may be\n * `undefined`, or is a function that may return `undefined`, with the `queryKey` tagged with the query's data\n * and error types.\n */\nexport type UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithUndefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * The options returned by the `queryOptions` overload selected when `initialData` is known to be defined,\n * with the `queryKey` tagged with the query's data and error types.\n */\nexport type DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = QueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey> &\n WithDefinedInitialData<TQueryFnData> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n *\n * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @param options - The {@link DefinedInitialQueryOptions} to use — everything you can pass to `useQuery`,\n * with `initialData` known to be defined.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postsOptions = queryOptions({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * initialData: [],\n * })\n *\n * // `data` is `Post[]`, never `undefined`, thanks to `initialData` — even if a refetch fails,\n * // so the list stays visible alongside the error.\n * const { data, isError, error } = useQuery(postsOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialQueryOptionsWithDataTag<TQueryFnData, TError, TData, TQueryKey>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so `queryClient` methods like `invalidateQueries`/`fetchQuery` always\n * read the current values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link DefinedInitialQueryOptions} to use, re-evaluated on demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred data\n * type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * initialData: { id: postId.value, title: '' },\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => DefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => DefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can\n * be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and\n * is the query key to generate options for.\n * @param options - The {@link UndefinedInitialQueryOptions} to use — everything you can pass to `useQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(id: string) {\n * return queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n * }\n *\n * const { data, isPending, isError, error } = useQuery(postOptions('1'))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\n/**\n * Same as the plain-object overload, but for options that close over reactive state (`ref`s read inside the\n * function body). Wrap them in a getter so the `queryKey` — and anything else derived from a `ref` — reacts\n * to changes, and so `queryClient` methods like `invalidateQueries`/`fetchQuery` always read the current\n * values instead of the ones captured when the options were created.\n * @param options - A function returning the {@link UndefinedInitialQueryOptions} to use, re-evaluated on\n * demand.\n * @returns A function that returns the same options object, typed so that `queryKey` carries the inferred\n * data type.\n * @see {@link useQuery} to run a query with these options.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue'\n * import { queryOptions, useQuery, useQueryClient } from '@tanstack/vue-query'\n *\n * const postId = ref(1)\n * const postOptions = queryOptions(() => ({\n * queryKey: ['post', postId.value],\n * queryFn: () => fetchPost(postId.value),\n * }))\n *\n * // Pass the getter itself, not `postOptions()`, so the query keeps reacting to `postId` changes.\n * const { data } = useQuery(postOptions)\n * const queryClient = useQueryClient()\n * // Here, call `postOptions()` so `invalidateQueries` reads the current `queryKey` right away.\n * queryClient.invalidateQueries(postOptions())\n * </script>\n * ```\n * @example\n * A parameterized factory that disables the query, type safe, until `postId` is set. The whole-options getter\n * re-evaluates `queryFn` on every change to `postId`. `queryFn` can also be a `computed`, but never a bare\n * getter, since a function there is the query function itself:\n * ```vue\n * <script setup lang=\"ts\">\n * import { queryOptions, skipToken, useQuery } from '@tanstack/vue-query'\n *\n * function postOptions(postId: number | undefined) {\n * return queryOptions(() => ({\n * queryKey: ['post', postId],\n * queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n * }))\n * }\n *\n * const props = defineProps<{ postId: number | undefined }>()\n * const { data, isLoading, isError, error } = useQuery(postOptions(props.postId))\n * </script>\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: () => UndefinedInitialQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >,\n): () => UndefinedInitialQueryOptionsWithDataTag<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n>\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AA4ZA,SAAgB,aAAa,SAAkB;CAC7C,OAAO;AACT"}
@@ -1,6 +1,5 @@
1
1
  import { DefaultError, DehydrateOptions, HydrateOptions, MutationCache, MutationObserverOptions, OmitKeyof, QueryCache, QueryObserverOptions } from "@tanstack/query-core";
2
2
  import { ComputedRef, Ref, UnwrapRef } from "vue-demi";
3
- //#region src/types.d.ts
4
3
  type Primitive = string | number | boolean | bigint | symbol | undefined | null;
5
4
  type UnwrapLeaf = Primitive | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any>;
6
5
  /** A plain value or a reactive getter (`() => T`) that returns one. */
@@ -91,6 +90,5 @@ interface QueryClientConfig {
91
90
  */
92
91
  defaultOptions?: DefaultOptions$1;
93
92
  }
94
- //#endregion
95
93
  export { MaybeRef as a, MutationOptions as c, ShallowOption as d, MaybeGetter as i, NoUnknown as l, DefaultOptions$1 as n, MaybeRefDeep as o, Equal as r, MaybeRefOrGetter as s, DeepUnwrapRef as t, QueryClientConfig as u };
96
- //# sourceMappingURL=types-sdZdiLgo.d.ts.map
94
+ //# sourceMappingURL=types-u_Tu5Ybs.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-sdZdiLgo.d.ts","names":["DefaultOptions"],"sources":["../../src/types.ts"],"mappings":";;;KAYK;KACA,aACD,YACA,WACA,OACA,QACA,SACA,gBACA,oBACA,WACA;;KAGQ,YAAY,KAAK,WAAW;;;;;KAM5B,SAAS,KAAK,IAAI,KAAK,YAAY,KAAK;;;;;;KAOxC,iBAAiB,KAAK,SAAS,YAAY;;;;;;KAO3C,aAAa,KAAK,SAC5B,UAAU,WACN,IACA,sBAEK,kBAAkB,IAAI,aAAa,EAAE,gBAExC;;;;;KAOI,UAAU,KAAK,eAAe,0BAA0B;;;;;KAMxD,MAAM,UAAU,cACxB,QAAQ,UAAU,4BAA2B,QAAQ,UAAU;;KAOvD,cAAc,KAAK,UAAU,aACrC,IACA,UAAU,UAAU,KAClB,cAAc,KACd,kBAEK,kBAAkB,IAAI,cAAc,EAAE,gBAEzC,UAAU;;;;KAKN;;;;EAIV;;;;;;KAOU,gBACV,iBACA,SAAS,cACT,mBACA,6BACE,UACF,wBAAwB,OAAO,QAAQ,YAAY,kCAGnD;;;;;;UAOeA,iBAAe,SAAS;;;;;EAKvC,UAAU,UAAU,8BAA8B,uBAChD;;;;;EAKF,YAAY,iCAAiC,4BAC3C;;;;EAIF,UAAU;;;;EAIV,YAAY;;;;;;UAOG;;;;EAIf,aAAa;;;;EAIb,gBAAgB;;;;EAIhB,iBAAiBA"}
1
+ {"version":3,"file":"types-u_Tu5Ybs.d.cts","names":["DefaultOptions"],"sources":["../../src/types.ts"],"mappings":";;KAYK;KACA,aACD,YACA,WACA,OACA,QACA,SACA,gBACA,oBACA,WACA;;KAGQ,YAAY,KAAK,WAAW;;;;;KAM5B,SAAS,KAAK,IAAI,KAAK,YAAY,KAAK;;;;;;KAOxC,iBAAiB,KAAK,SAAS,YAAY;;;;;;KAO3C,aAAa,KAAK,SAC5B,UAAU,WACN,IACA,sBAEK,kBAAkB,IAAI,aAAa,EAAE,gBAExC;;;;;KAOI,UAAU,KAAK,eAAe,0BAA0B;;;;;KAMxD,MAAM,UAAU,cACxB,QAAQ,UAAU,4BAA2B,QAAQ,UAAU;;KAOvD,cAAc,KAAK,UAAU,aACrC,IACA,UAAU,UAAU,KAClB,cAAc,KACd,kBAEK,kBAAkB,IAAI,cAAc,EAAE,gBAEzC,UAAU;;;;KAKN;;;;EAIV;;;;;;KAOU,gBACV,iBACA,SAAS,cACT,mBACA,6BACE,UACF,wBAAwB,OAAO,QAAQ,YAAY,kCAGnD;;;;;;UAOeA,iBAAe,SAAS;;;;;EAKvC,UAAU,UAAU,8BAA8B,uBAChD;;;;;EAKF,YAAY,iCAAiC,4BAC3C;;;;EAIF,UAAU;;;;EAIV,YAAY;;;;;;UAOG;;;;EAIf,aAAa;;;;EAIb,gBAAgB;;;;EAIhB,iBAAiBA"}
@@ -1,6 +1,5 @@
1
1
  import { DefaultError, DehydrateOptions, HydrateOptions, MutationCache, MutationObserverOptions, OmitKeyof, QueryCache, QueryObserverOptions } from "@tanstack/query-core";
2
2
  import { ComputedRef, Ref, UnwrapRef } from "vue-demi";
3
- //#region src/types.d.ts
4
3
  type Primitive = string | number | boolean | bigint | symbol | undefined | null;
5
4
  type UnwrapLeaf = Primitive | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any>;
6
5
  /** A plain value or a reactive getter (`() => T`) that returns one. */
@@ -91,6 +90,5 @@ interface QueryClientConfig {
91
90
  */
92
91
  defaultOptions?: DefaultOptions$1;
93
92
  }
94
- //#endregion
95
93
  export { MaybeRef as a, MutationOptions as c, ShallowOption as d, MaybeGetter as i, NoUnknown as l, DefaultOptions$1 as n, MaybeRefDeep as o, Equal as r, MaybeRefOrGetter as s, DeepUnwrapRef as t, QueryClientConfig as u };
96
- //# sourceMappingURL=types-sdZdiLgo.d.ts.map
94
+ //# sourceMappingURL=types-u_Tu5Ybs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-u_Tu5Ybs.d.ts","names":["DefaultOptions"],"sources":["../../src/types.ts"],"mappings":";;KAYK;KACA,aACD,YACA,WACA,OACA,QACA,SACA,gBACA,oBACA,WACA;;KAGQ,YAAY,KAAK,WAAW;;;;;KAM5B,SAAS,KAAK,IAAI,KAAK,YAAY,KAAK;;;;;;KAOxC,iBAAiB,KAAK,SAAS,YAAY;;;;;;KAO3C,aAAa,KAAK,SAC5B,UAAU,WACN,IACA,sBAEK,kBAAkB,IAAI,aAAa,EAAE,gBAExC;;;;;KAOI,UAAU,KAAK,eAAe,0BAA0B;;;;;KAMxD,MAAM,UAAU,cACxB,QAAQ,UAAU,4BAA2B,QAAQ,UAAU;;KAOvD,cAAc,KAAK,UAAU,aACrC,IACA,UAAU,UAAU,KAClB,cAAc,KACd,kBAEK,kBAAkB,IAAI,cAAc,EAAE,gBAEzC,UAAU;;;;KAKN;;;;EAIV;;;;;;KAOU,gBACV,iBACA,SAAS,cACT,mBACA,6BACE,UACF,wBAAwB,OAAO,QAAQ,YAAY,kCAGnD;;;;;;UAOeA,iBAAe,SAAS;;;;;EAKvC,UAAU,UAAU,8BAA8B,uBAChD;;;;;EAKF,YAAY,iCAAiC,4BAC3C;;;;EAIF,UAAU;;;;EAIV,YAAY;;;;;;UAOG;;;;EAIf,aAAa;;;;EAIb,gBAAgB;;;;EAIhB,iBAAiBA"}
@@ -1,2 +1,2 @@
1
- import { a as MaybeRef, c as MutationOptions, d as ShallowOption, i as MaybeGetter, l as NoUnknown, n as DefaultOptions, o as MaybeRefDeep, r as Equal, s as MaybeRefOrGetter, t as DeepUnwrapRef, u as QueryClientConfig } from "./types-sdZdiLgo.cjs";
1
+ import { a as MaybeRef, c as MutationOptions, d as ShallowOption, i as MaybeGetter, l as NoUnknown, n as DefaultOptions, o as MaybeRefDeep, r as Equal, s as MaybeRefOrGetter, t as DeepUnwrapRef, u as QueryClientConfig } from "./types-u_Tu5Ybs.cjs";
2
2
  export { DeepUnwrapRef, DefaultOptions, Equal, MaybeGetter, MaybeRef, MaybeRefDeep, MaybeRefOrGetter, MutationOptions, NoUnknown, QueryClientConfig, ShallowOption };
@@ -1,2 +1,2 @@
1
- import { a as MaybeRef, c as MutationOptions, d as ShallowOption, i as MaybeGetter, l as NoUnknown, n as DefaultOptions, o as MaybeRefDeep, r as Equal, s as MaybeRefOrGetter, t as DeepUnwrapRef, u as QueryClientConfig } from "./types-sdZdiLgo.js";
1
+ import { a as MaybeRef, c as MutationOptions, d as ShallowOption, i as MaybeGetter, l as NoUnknown, n as DefaultOptions, o as MaybeRefDeep, r as Equal, s as MaybeRefOrGetter, t as DeepUnwrapRef, u as QueryClientConfig } from "./types-u_Tu5Ybs.js";
2
2
  export { DeepUnwrapRef, DefaultOptions, Equal, MaybeGetter, MaybeRef, MaybeRefDeep, MaybeRefOrGetter, MutationOptions, NoUnknown, QueryClientConfig, ShallowOption };
@@ -3,7 +3,7 @@ const require_utils = require("./utils.cjs");
3
3
  const require_useQueryClient = require("./useQueryClient.cjs");
4
4
  let _tanstack_query_core = require("@tanstack/query-core");
5
5
  let vue_demi = require("vue-demi");
6
- //#region src/useBaseQuery.ts
6
+ // src/useBaseQuery.ts
7
7
  /**
8
8
  * Base implementation shared by `useQuery` and `useInfiniteQuery`.
9
9
  * @param Observer - The observer class from query-core (`QueryObserver` or `InfiniteQueryObserver`).
@@ -83,7 +83,6 @@ function useBaseQuery(Observer, options, queryClient) {
83
83
  object.refetch = refetch;
84
84
  return object;
85
85
  }
86
- //#endregion
87
86
  exports.useBaseQuery = useBaseQuery;
88
87
 
89
88
  //# sourceMappingURL=useBaseQuery.cjs.map
@@ -1,2 +1,2 @@
1
- import { c as useBaseQuery, s as UseBaseQueryReturnType } from "./infiniteQueryOptions-BOLnyklt.cjs";
1
+ import { c as useBaseQuery, s as UseBaseQueryReturnType } from "./infiniteQueryOptions-oStzZOCq.cjs";
2
2
  export { UseBaseQueryReturnType, useBaseQuery };
@@ -1,2 +1,2 @@
1
- import { c as useBaseQuery, s as UseBaseQueryReturnType } from "./infiniteQueryOptions-CoRGgnPB.js";
1
+ import { c as useBaseQuery, s as UseBaseQueryReturnType } from "./infiniteQueryOptions-BLGtkUwV.js";
2
2
  export { UseBaseQueryReturnType, useBaseQuery };
@@ -2,7 +2,7 @@ import { cloneDeepUnref, updateState } from "./utils.js";
2
2
  import { useQueryClient } from "./useQueryClient.js";
3
3
  import { shouldThrowError } from "@tanstack/query-core";
4
4
  import { computed, getCurrentScope, onScopeDispose, reactive, readonly, shallowReactive, shallowReadonly, toRefs, watch } from "vue-demi";
5
- //#region src/useBaseQuery.ts
5
+ // src/useBaseQuery.ts
6
6
  /**
7
7
  * Base implementation shared by `useQuery` and `useInfiniteQuery`.
8
8
  * @param Observer - The observer class from query-core (`QueryObserver` or `InfiniteQueryObserver`).
@@ -82,7 +82,6 @@ function useBaseQuery(Observer, options, queryClient) {
82
82
  object.refetch = refetch;
83
83
  return object;
84
84
  }
85
- //#endregion
86
85
  export { useBaseQuery };
87
86
 
88
87
  //# sourceMappingURL=useBaseQuery.js.map
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_useBaseQuery = require("./useBaseQuery.cjs");
3
3
  let _tanstack_query_core = require("@tanstack/query-core");
4
- //#region src/useInfiniteQuery.ts
4
+ // src/useInfiniteQuery.ts
5
5
  function useInfiniteQuery(options, queryClient) {
6
6
  return require_useBaseQuery.useBaseQuery(_tanstack_query_core.InfiniteQueryObserver, options, queryClient);
7
7
  }
8
- //#endregion
9
8
  exports.useInfiniteQuery = useInfiniteQuery;
10
9
 
11
10
  //# sourceMappingURL=useInfiniteQuery.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInfiniteQuery.cjs","names":["useBaseQuery","InfiniteQueryObserver"],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\n\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\n\nimport type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The options accepted by `useInfiniteQuery`. Same as {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core`, plus the `shallow` option. Each option except `shallow` can also be a `ref` (and\n * `enabled` a reactive getter).\n */\nexport type UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = MaybeRef<\n {\n [\n Property in keyof InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n ]: Property extends 'enabled'\n ? MaybeRefOrGetter<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n : MaybeRefDeep<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n } & ShallowOption\n>\n\n/**\n * The result of `useInfiniteQuery`: {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, with\n * its properties wrapped in `Ref`s as in {@link UseBaseQueryReturnType}.\n */\nexport type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<\n TData,\n TError,\n InfiniteQueryObserverResult<TData, TError>\n>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless\n * a `select` changes `TData` to include `undefined`).\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`, with `initialData` set.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the\n * // list stays visible alongside the error.\n * const { data, isError, error } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isError\">Error: {{ error.message }}</span>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <button @click=\"fetchNextPage()\" :disabled=\"!hasNextPage || isFetching\">\n * {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}\n * </button>\n * </template>\n * </template>\n * ```\n * @example\n * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a\n * sentinel element after the list:\n * ```vue\n * <script setup lang=\"ts\">\n * import { onUnmounted, ref, watch } from 'vue'\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * const sentinel = ref<HTMLElement>()\n * let observer: IntersectionObserver | undefined\n *\n * watch(sentinel, (el) => {\n * observer?.disconnect()\n * if (el == null) return\n *\n * observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {\n * fetchNextPage()\n * }\n * })\n * observer.observe(el)\n * })\n *\n * onUnmounted(() => observer?.disconnect())\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <div ref=\"sentinel\">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>\n * </template>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * Fallback overload for options whose `initialData` presence isn't statically known — for example, a\n * `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other\n * overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to\n * use.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.\n * @example\n * Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ projectId: number; maxPages: number }>()\n *\n * const { data } = useInfiniteQuery(() => ({\n * queryKey: ['project', props.projectId, 'issues'],\n * queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * maxPages: props.maxPages,\n * }))\n * </script>\n *\n * <template>\n * <template v-for=\"page in data?.pages\" :key=\"page.nextId\">\n * <li v-for=\"issue in page.issues\" :key=\"issue.id\">{{ issue.title }}</li>\n * </template>\n * </template>\n * ```\n * @example\n * A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of\n * setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the\n * getter is what re-evaluates it on every change to `props.postId`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ postId: string | undefined }>()\n *\n * // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.\n * const { data, isLoading, isError, error } = useInfiniteQuery(() => {\n * const postId = props.postId\n * return {\n * queryKey: ['post', postId, 'comments'],\n * queryFn:\n * postId != null\n * ? ({ pageParam }) => fetchComments(postId, pageParam)\n * : skipToken,\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * }\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"props.postId == null\">Select a post</span>\n * <span v-else-if=\"isLoading\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <ul v-else>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"comment in page.comments\" :key=\"comment.id\">{{ comment.text }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\nexport function useInfiniteQuery(\n options: MaybeRefOrGetter<UseInfiniteQueryOptions>,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n InfiniteQueryObserver as typeof QueryObserver,\n options,\n queryClient,\n )\n}\n"],"mappings":";;;;AA2WA,SAAgB,iBACd,SACA,aACA;CACA,OAAOA,qBAAAA,aACLC,qBAAAA,uBACA,SACA,WACF;AACF"}
1
+ {"version":3,"file":"useInfiniteQuery.cjs","names":["useBaseQuery","InfiniteQueryObserver"],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\n\nimport type { UseBaseQueryReturnType } from './useBaseQuery'\n\nimport type {\n DeepUnwrapRef,\n MaybeRef,\n MaybeRefDeep,\n MaybeRefOrGetter,\n ShallowOption,\n} from './types'\nimport type { QueryClient } from './queryClient'\n\n/**\n * The options accepted by `useInfiniteQuery`. Same as {@link InfiniteQueryObserverOptions} from\n * `@tanstack/query-core`, plus the `shallow` option. Each option except `shallow` can also be a `ref` (and\n * `enabled` a reactive getter).\n */\nexport type UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = MaybeRef<\n {\n [\n Property in keyof InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n ]: Property extends 'enabled'\n ? MaybeRefOrGetter<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n : MaybeRefDeep<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n DeepUnwrapRef<TQueryKey>,\n TPageParam\n >[Property]\n >\n } & ShallowOption\n>\n\n/**\n * The result of `useInfiniteQuery`: {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, with\n * its properties wrapped in `Ref`s as in {@link UseBaseQueryReturnType}.\n */\nexport type UseInfiniteQueryReturnType<TData, TError> = UseBaseQueryReturnType<\n TData,\n TError,\n InfiniteQueryObserverResult<TData, TError>\n>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * This overload is selected when `initialData` is known to be defined, so the resulting `data` is never\n * `undefined` (unless a `select` changes `TData` to include `undefined`).\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`, with `initialData` known to be defined.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * // `data` is never `undefined`, thanks to `initialData` — even if a refetch fails, so the\n * // list stays visible alongside the error.\n * const { data, isError, error } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isError\">Error: {{ error.message }}</span>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to\n * `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.value.pages` and\n * `data.value.pageParams` are also added, as long as a `select` doesn't change `TData` away from its default\n * `InfiniteData<TQueryFnData>` shape.\n * @remarks Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default\n * refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user\n * actions, or add conditions like `hasNextPage && !isFetching`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <button @click=\"fetchNextPage()\" :disabled=\"!hasNextPage || isFetching\">\n * {{ isFetchingNextPage ? 'Loading more...' : hasNextPage ? 'Load More' : 'Nothing more to load' }}\n * </button>\n * </template>\n * </template>\n * ```\n * @example\n * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a\n * sentinel element after the list:\n * ```vue\n * <script setup lang=\"ts\">\n * import { onUnmounted, ref, watch } from 'vue'\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const {\n * data,\n * isPending,\n * isError,\n * error,\n * fetchNextPage,\n * hasNextPage,\n * isFetching,\n * isFetchingNextPage,\n * } = useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * const sentinel = ref<HTMLElement>()\n * let observer: IntersectionObserver | undefined\n *\n * watch(sentinel, (el) => {\n * observer?.disconnect()\n * if (el == null) return\n *\n * observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting && hasNextPage.value && !isFetching.value) {\n * fetchNextPage()\n * }\n * })\n * observer.observe(el)\n * })\n *\n * onUnmounted(() => observer?.disconnect())\n * </script>\n *\n * <template>\n * <span v-if=\"isPending\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <template v-else>\n * <ul>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"project in page.projects\" :key=\"project.id\">{{ project.name }}</li>\n * </template>\n * </ul>\n * <div ref=\"sentinel\">{{ isFetchingNextPage ? 'Loading more...' : '' }}</div>\n * </template>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\n/**\n * Fallback overload for options whose `initialData` presence isn't statically known — for example, a\n * `ref`/reactive object built up conditionally, rather than a plain object literal. Prefer one of the other\n * overloads when possible, since they infer whether `data` can be `undefined` from `initialData` directly.\n *\n * `enabled` tracks reactive dependencies automatically as a `ref`, a plain value, or a reactive getter\n * (`() => ...`). `queryKey` reacts through a `ref` for the array itself, or `ref`s and reactive getters as\n * individual entries — the array itself can't be a bare getter.\n * @param options - A `ref`, plain value, or reactive getter resolving to the {@link UseInfiniteQueryOptions} to\n * use.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one provided by `VueQueryPlugin`\n * will be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`.\n * @example\n * Passing a whole-options getter so `maxPages` reacts to a setting stored elsewhere, not just `queryKey`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ projectId: number; maxPages: number }>()\n *\n * const { data } = useInfiniteQuery(() => ({\n * queryKey: ['project', props.projectId, 'issues'],\n * queryFn: ({ pageParam }) => fetchIssues(props.projectId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * maxPages: props.maxPages,\n * }))\n * </script>\n *\n * <template>\n * <template v-for=\"page in data?.pages\" :key=\"page.nextId\">\n * <li v-for=\"issue in page.issues\" :key=\"issue.id\">{{ issue.title }}</li>\n * </template>\n * </template>\n * ```\n * @example\n * A query that's disabled, type-safe, until `postId` is set — pass `skipToken` as `queryFn` instead of\n * setting `enabled: false`. This requires a whole-options getter: `queryFn` isn't itself reactive, so the\n * getter is what re-evaluates it on every change to `props.postId`:\n * ```vue\n * <script setup lang=\"ts\">\n * import { skipToken, useInfiniteQuery } from '@tanstack/vue-query'\n *\n * const props = defineProps<{ postId: string | undefined }>()\n *\n * // Use `isLoading`, not `isPending`, so the loading state doesn't show while the query is disabled.\n * const { data, isLoading, isError, error } = useInfiniteQuery(() => {\n * const postId = props.postId\n * return {\n * queryKey: ['post', postId, 'comments'],\n * queryFn:\n * postId != null\n * ? ({ pageParam }) => fetchComments(postId, pageParam)\n * : skipToken,\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * }\n * })\n * </script>\n *\n * <template>\n * <span v-if=\"props.postId == null\">Select a post</span>\n * <span v-else-if=\"isLoading\">Loading...</span>\n * <span v-else-if=\"isError\">Error: {{ error.message }}</span>\n * <ul v-else>\n * <template v-for=\"page in data.pages\" :key=\"page.nextId\">\n * <li v-for=\"comment in page.comments\" :key=\"comment.id\">{{ comment.text }}</li>\n * </template>\n * </ul>\n * </template>\n * ```\n */\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: MaybeRefOrGetter<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryReturnType<TData, TError>\n\nexport function useInfiniteQuery(\n options: MaybeRefOrGetter<UseInfiniteQueryOptions>,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n InfiniteQueryObserver as typeof QueryObserver,\n options,\n queryClient,\n )\n}\n"],"mappings":";;;;AA2WA,SAAgB,iBACd,SACA,aACA;CACA,OAAOA,qBAAAA,aACLC,qBAAAA,uBACA,SACA,WACF;AACF"}
@@ -1,2 +1,2 @@
1
- import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-BOLnyklt.cjs";
1
+ import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-oStzZOCq.cjs";
2
2
  export { UseInfiniteQueryOptions, UseInfiniteQueryReturnType, useInfiniteQuery };
@@ -1,2 +1,2 @@
1
- import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-CoRGgnPB.js";
1
+ import { a as UseInfiniteQueryReturnType, i as UseInfiniteQueryOptions, o as useInfiniteQuery } from "./infiniteQueryOptions-BLGtkUwV.js";
2
2
  export { UseInfiniteQueryOptions, UseInfiniteQueryReturnType, useInfiniteQuery };
@@ -1,10 +1,9 @@
1
1
  import { useBaseQuery } from "./useBaseQuery.js";
2
2
  import { InfiniteQueryObserver } from "@tanstack/query-core";
3
- //#region src/useInfiniteQuery.ts
3
+ // src/useInfiniteQuery.ts
4
4
  function useInfiniteQuery(options, queryClient) {
5
5
  return useBaseQuery(InfiniteQueryObserver, options, queryClient);
6
6
  }
7
- //#endregion
8
7
  export { useInfiniteQuery };
9
8
 
10
9
  //# sourceMappingURL=useInfiniteQuery.js.map