@tanstack/react-query 5.104.5 → 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 (301) hide show
  1. package/build/legacy/HydrationBoundary.cjs +2 -3
  2. package/build/legacy/HydrationBoundary.cjs.map +1 -1
  3. package/build/legacy/HydrationBoundary.d.cts +0 -2
  4. package/build/legacy/HydrationBoundary.d.cts.map +1 -1
  5. package/build/legacy/HydrationBoundary.d.ts +0 -2
  6. package/build/legacy/HydrationBoundary.d.ts.map +1 -1
  7. package/build/legacy/HydrationBoundary.js +1 -2
  8. package/build/legacy/HydrationBoundary.js.map +1 -1
  9. package/build/legacy/IsRestoringProvider.cjs +2 -3
  10. package/build/legacy/IsRestoringProvider.d.cts +0 -2
  11. package/build/legacy/IsRestoringProvider.d.cts.map +1 -1
  12. package/build/legacy/IsRestoringProvider.d.ts +0 -2
  13. package/build/legacy/IsRestoringProvider.d.ts.map +1 -1
  14. package/build/legacy/IsRestoringProvider.js +1 -2
  15. package/build/legacy/QueryClientProvider.cjs +2 -3
  16. package/build/legacy/QueryClientProvider.d.cts +0 -2
  17. package/build/legacy/QueryClientProvider.d.cts.map +1 -1
  18. package/build/legacy/QueryClientProvider.d.ts +0 -2
  19. package/build/legacy/QueryClientProvider.d.ts.map +1 -1
  20. package/build/legacy/QueryClientProvider.js +1 -2
  21. package/build/legacy/QueryErrorResetBoundary.cjs +2 -3
  22. package/build/legacy/QueryErrorResetBoundary.d.cts +1 -3
  23. package/build/legacy/QueryErrorResetBoundary.d.cts.map +1 -1
  24. package/build/legacy/QueryErrorResetBoundary.d.ts +1 -3
  25. package/build/legacy/QueryErrorResetBoundary.d.ts.map +1 -1
  26. package/build/legacy/QueryErrorResetBoundary.js +1 -2
  27. package/build/legacy/errorBoundaryUtils.cjs +2 -3
  28. package/build/legacy/errorBoundaryUtils.d.cts +0 -2
  29. package/build/legacy/errorBoundaryUtils.d.cts.map +1 -1
  30. package/build/legacy/errorBoundaryUtils.d.ts +0 -2
  31. package/build/legacy/errorBoundaryUtils.d.ts.map +1 -1
  32. package/build/legacy/errorBoundaryUtils.js +1 -2
  33. package/build/legacy/index.cjs +1 -2
  34. package/build/legacy/index.js +1 -2
  35. package/build/legacy/infiniteQueryOptions.cjs +1 -2
  36. package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
  37. package/build/legacy/infiniteQueryOptions.d.cts +16 -16
  38. package/build/legacy/infiniteQueryOptions.d.cts.map +1 -1
  39. package/build/legacy/infiniteQueryOptions.d.ts +16 -16
  40. package/build/legacy/infiniteQueryOptions.d.ts.map +1 -1
  41. package/build/legacy/infiniteQueryOptions.js +1 -2
  42. package/build/legacy/infiniteQueryOptions.js.map +1 -1
  43. package/build/legacy/mutationOptions.cjs +1 -2
  44. package/build/legacy/mutationOptions.d.cts +0 -2
  45. package/build/legacy/mutationOptions.d.cts.map +1 -1
  46. package/build/legacy/mutationOptions.d.ts +0 -2
  47. package/build/legacy/mutationOptions.d.ts.map +1 -1
  48. package/build/legacy/mutationOptions.js +1 -2
  49. package/build/legacy/queryOptions.cjs +1 -2
  50. package/build/legacy/queryOptions.cjs.map +1 -1
  51. package/build/legacy/queryOptions.d.cts +16 -15
  52. package/build/legacy/queryOptions.d.cts.map +1 -1
  53. package/build/legacy/queryOptions.d.ts +16 -15
  54. package/build/legacy/queryOptions.d.ts.map +1 -1
  55. package/build/legacy/queryOptions.js +1 -2
  56. package/build/legacy/queryOptions.js.map +1 -1
  57. package/build/legacy/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
  58. package/build/legacy/suspense.cjs +1 -2
  59. package/build/legacy/suspense.d.cts +0 -2
  60. package/build/legacy/suspense.d.cts.map +1 -1
  61. package/build/legacy/suspense.d.ts +0 -2
  62. package/build/legacy/suspense.d.ts.map +1 -1
  63. package/build/legacy/suspense.js +1 -2
  64. package/build/legacy/types.cjs +1 -2
  65. package/build/legacy/types.d.cts +0 -2
  66. package/build/legacy/types.d.cts.map +1 -1
  67. package/build/legacy/types.d.ts +0 -2
  68. package/build/legacy/types.d.ts.map +1 -1
  69. package/build/legacy/types.js +1 -2
  70. package/build/legacy/useBaseQuery.cjs +2 -3
  71. package/build/legacy/useBaseQuery.d.cts +0 -2
  72. package/build/legacy/useBaseQuery.d.cts.map +1 -1
  73. package/build/legacy/useBaseQuery.d.ts +0 -2
  74. package/build/legacy/useBaseQuery.d.ts.map +1 -1
  75. package/build/legacy/useBaseQuery.js +1 -2
  76. package/build/legacy/useInfiniteQuery.cjs +1 -2
  77. package/build/legacy/useInfiniteQuery.cjs.map +1 -1
  78. package/build/legacy/useInfiniteQuery.d.cts +2 -4
  79. package/build/legacy/useInfiniteQuery.d.cts.map +1 -1
  80. package/build/legacy/useInfiniteQuery.d.ts +2 -4
  81. package/build/legacy/useInfiniteQuery.d.ts.map +1 -1
  82. package/build/legacy/useInfiniteQuery.js +1 -2
  83. package/build/legacy/useInfiniteQuery.js.map +1 -1
  84. package/build/legacy/useIsFetching.cjs +2 -3
  85. package/build/legacy/useIsFetching.cjs.map +1 -1
  86. package/build/legacy/useIsFetching.d.cts +1 -3
  87. package/build/legacy/useIsFetching.d.cts.map +1 -1
  88. package/build/legacy/useIsFetching.d.ts +1 -3
  89. package/build/legacy/useIsFetching.d.ts.map +1 -1
  90. package/build/legacy/useIsFetching.js +1 -2
  91. package/build/legacy/useIsFetching.js.map +1 -1
  92. package/build/legacy/useMutation.cjs +2 -3
  93. package/build/legacy/useMutation.d.cts +0 -2
  94. package/build/legacy/useMutation.d.cts.map +1 -1
  95. package/build/legacy/useMutation.d.ts +0 -2
  96. package/build/legacy/useMutation.d.ts.map +1 -1
  97. package/build/legacy/useMutation.js +1 -2
  98. package/build/legacy/useMutationState.cjs +2 -3
  99. package/build/legacy/useMutationState.d.cts +0 -2
  100. package/build/legacy/useMutationState.d.cts.map +1 -1
  101. package/build/legacy/useMutationState.d.ts +0 -2
  102. package/build/legacy/useMutationState.d.ts.map +1 -1
  103. package/build/legacy/useMutationState.js +1 -2
  104. package/build/legacy/usePrefetchInfiniteQuery.cjs +1 -2
  105. package/build/legacy/usePrefetchInfiniteQuery.d.cts +0 -2
  106. package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
  107. package/build/legacy/usePrefetchInfiniteQuery.d.ts +0 -2
  108. package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
  109. package/build/legacy/usePrefetchInfiniteQuery.js +1 -2
  110. package/build/legacy/usePrefetchQuery.cjs +1 -2
  111. package/build/legacy/usePrefetchQuery.d.cts +0 -2
  112. package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
  113. package/build/legacy/usePrefetchQuery.d.ts +0 -2
  114. package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
  115. package/build/legacy/usePrefetchQuery.js +1 -2
  116. package/build/legacy/useQueries.cjs +2 -3
  117. package/build/legacy/useQueries.d.cts +0 -2
  118. package/build/legacy/useQueries.d.cts.map +1 -1
  119. package/build/legacy/useQueries.d.ts +0 -2
  120. package/build/legacy/useQueries.d.ts.map +1 -1
  121. package/build/legacy/useQueries.js +1 -2
  122. package/build/legacy/useQuery.cjs +1 -2
  123. package/build/legacy/useQuery.cjs.map +1 -1
  124. package/build/legacy/useQuery.d.cts +5 -7
  125. package/build/legacy/useQuery.d.cts.map +1 -1
  126. package/build/legacy/useQuery.d.ts +5 -7
  127. package/build/legacy/useQuery.d.ts.map +1 -1
  128. package/build/legacy/useQuery.js +1 -2
  129. package/build/legacy/useQuery.js.map +1 -1
  130. package/build/legacy/useSuspenseInfiniteQuery.cjs +1 -2
  131. package/build/legacy/useSuspenseInfiniteQuery.d.cts +0 -2
  132. package/build/legacy/useSuspenseInfiniteQuery.d.cts.map +1 -1
  133. package/build/legacy/useSuspenseInfiniteQuery.d.ts +0 -2
  134. package/build/legacy/useSuspenseInfiniteQuery.d.ts.map +1 -1
  135. package/build/legacy/useSuspenseInfiniteQuery.js +1 -2
  136. package/build/legacy/useSuspenseQueries.cjs +1 -2
  137. package/build/legacy/useSuspenseQueries.d.cts +0 -2
  138. package/build/legacy/useSuspenseQueries.d.cts.map +1 -1
  139. package/build/legacy/useSuspenseQueries.d.ts +0 -2
  140. package/build/legacy/useSuspenseQueries.d.ts.map +1 -1
  141. package/build/legacy/useSuspenseQueries.js +1 -2
  142. package/build/legacy/useSuspenseQuery.cjs +1 -2
  143. package/build/legacy/useSuspenseQuery.d.cts +0 -2
  144. package/build/legacy/useSuspenseQuery.d.cts.map +1 -1
  145. package/build/legacy/useSuspenseQuery.d.ts +0 -2
  146. package/build/legacy/useSuspenseQuery.d.ts.map +1 -1
  147. package/build/legacy/useSuspenseQuery.js +1 -2
  148. package/build/modern/HydrationBoundary.cjs +2 -3
  149. package/build/modern/HydrationBoundary.cjs.map +1 -1
  150. package/build/modern/HydrationBoundary.d.cts +0 -2
  151. package/build/modern/HydrationBoundary.d.cts.map +1 -1
  152. package/build/modern/HydrationBoundary.d.ts +0 -2
  153. package/build/modern/HydrationBoundary.d.ts.map +1 -1
  154. package/build/modern/HydrationBoundary.js +1 -2
  155. package/build/modern/HydrationBoundary.js.map +1 -1
  156. package/build/modern/IsRestoringProvider.cjs +2 -3
  157. package/build/modern/IsRestoringProvider.d.cts +0 -2
  158. package/build/modern/IsRestoringProvider.d.cts.map +1 -1
  159. package/build/modern/IsRestoringProvider.d.ts +0 -2
  160. package/build/modern/IsRestoringProvider.d.ts.map +1 -1
  161. package/build/modern/IsRestoringProvider.js +1 -2
  162. package/build/modern/QueryClientProvider.cjs +2 -3
  163. package/build/modern/QueryClientProvider.d.cts +0 -2
  164. package/build/modern/QueryClientProvider.d.cts.map +1 -1
  165. package/build/modern/QueryClientProvider.d.ts +0 -2
  166. package/build/modern/QueryClientProvider.d.ts.map +1 -1
  167. package/build/modern/QueryClientProvider.js +1 -2
  168. package/build/modern/QueryErrorResetBoundary.cjs +2 -3
  169. package/build/modern/QueryErrorResetBoundary.d.cts +1 -3
  170. package/build/modern/QueryErrorResetBoundary.d.cts.map +1 -1
  171. package/build/modern/QueryErrorResetBoundary.d.ts +1 -3
  172. package/build/modern/QueryErrorResetBoundary.d.ts.map +1 -1
  173. package/build/modern/QueryErrorResetBoundary.js +1 -2
  174. package/build/modern/errorBoundaryUtils.cjs +2 -3
  175. package/build/modern/errorBoundaryUtils.d.cts +0 -2
  176. package/build/modern/errorBoundaryUtils.d.cts.map +1 -1
  177. package/build/modern/errorBoundaryUtils.d.ts +0 -2
  178. package/build/modern/errorBoundaryUtils.d.ts.map +1 -1
  179. package/build/modern/errorBoundaryUtils.js +1 -2
  180. package/build/modern/index.cjs +1 -2
  181. package/build/modern/index.js +1 -2
  182. package/build/modern/infiniteQueryOptions.cjs +1 -2
  183. package/build/modern/infiniteQueryOptions.cjs.map +1 -1
  184. package/build/modern/infiniteQueryOptions.d.cts +16 -16
  185. package/build/modern/infiniteQueryOptions.d.cts.map +1 -1
  186. package/build/modern/infiniteQueryOptions.d.ts +16 -16
  187. package/build/modern/infiniteQueryOptions.d.ts.map +1 -1
  188. package/build/modern/infiniteQueryOptions.js +1 -2
  189. package/build/modern/infiniteQueryOptions.js.map +1 -1
  190. package/build/modern/mutationOptions.cjs +1 -2
  191. package/build/modern/mutationOptions.d.cts +0 -2
  192. package/build/modern/mutationOptions.d.cts.map +1 -1
  193. package/build/modern/mutationOptions.d.ts +0 -2
  194. package/build/modern/mutationOptions.d.ts.map +1 -1
  195. package/build/modern/mutationOptions.js +1 -2
  196. package/build/modern/queryOptions.cjs +1 -2
  197. package/build/modern/queryOptions.cjs.map +1 -1
  198. package/build/modern/queryOptions.d.cts +16 -15
  199. package/build/modern/queryOptions.d.cts.map +1 -1
  200. package/build/modern/queryOptions.d.ts +16 -15
  201. package/build/modern/queryOptions.d.ts.map +1 -1
  202. package/build/modern/queryOptions.js +1 -2
  203. package/build/modern/queryOptions.js.map +1 -1
  204. package/build/modern/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
  205. package/build/modern/suspense.cjs +1 -2
  206. package/build/modern/suspense.d.cts +0 -2
  207. package/build/modern/suspense.d.cts.map +1 -1
  208. package/build/modern/suspense.d.ts +0 -2
  209. package/build/modern/suspense.d.ts.map +1 -1
  210. package/build/modern/suspense.js +1 -2
  211. package/build/modern/types.cjs +1 -2
  212. package/build/modern/types.d.cts +0 -2
  213. package/build/modern/types.d.cts.map +1 -1
  214. package/build/modern/types.d.ts +0 -2
  215. package/build/modern/types.d.ts.map +1 -1
  216. package/build/modern/types.js +1 -2
  217. package/build/modern/useBaseQuery.cjs +2 -3
  218. package/build/modern/useBaseQuery.d.cts +0 -2
  219. package/build/modern/useBaseQuery.d.cts.map +1 -1
  220. package/build/modern/useBaseQuery.d.ts +0 -2
  221. package/build/modern/useBaseQuery.d.ts.map +1 -1
  222. package/build/modern/useBaseQuery.js +1 -2
  223. package/build/modern/useInfiniteQuery.cjs +1 -2
  224. package/build/modern/useInfiniteQuery.cjs.map +1 -1
  225. package/build/modern/useInfiniteQuery.d.cts +2 -4
  226. package/build/modern/useInfiniteQuery.d.cts.map +1 -1
  227. package/build/modern/useInfiniteQuery.d.ts +2 -4
  228. package/build/modern/useInfiniteQuery.d.ts.map +1 -1
  229. package/build/modern/useInfiniteQuery.js +1 -2
  230. package/build/modern/useInfiniteQuery.js.map +1 -1
  231. package/build/modern/useIsFetching.cjs +2 -3
  232. package/build/modern/useIsFetching.cjs.map +1 -1
  233. package/build/modern/useIsFetching.d.cts +1 -3
  234. package/build/modern/useIsFetching.d.cts.map +1 -1
  235. package/build/modern/useIsFetching.d.ts +1 -3
  236. package/build/modern/useIsFetching.d.ts.map +1 -1
  237. package/build/modern/useIsFetching.js +1 -2
  238. package/build/modern/useIsFetching.js.map +1 -1
  239. package/build/modern/useMutation.cjs +2 -3
  240. package/build/modern/useMutation.d.cts +0 -2
  241. package/build/modern/useMutation.d.cts.map +1 -1
  242. package/build/modern/useMutation.d.ts +0 -2
  243. package/build/modern/useMutation.d.ts.map +1 -1
  244. package/build/modern/useMutation.js +1 -2
  245. package/build/modern/useMutationState.cjs +2 -3
  246. package/build/modern/useMutationState.d.cts +0 -2
  247. package/build/modern/useMutationState.d.cts.map +1 -1
  248. package/build/modern/useMutationState.d.ts +0 -2
  249. package/build/modern/useMutationState.d.ts.map +1 -1
  250. package/build/modern/useMutationState.js +1 -2
  251. package/build/modern/usePrefetchInfiniteQuery.cjs +1 -2
  252. package/build/modern/usePrefetchInfiniteQuery.d.cts +0 -2
  253. package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
  254. package/build/modern/usePrefetchInfiniteQuery.d.ts +0 -2
  255. package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
  256. package/build/modern/usePrefetchInfiniteQuery.js +1 -2
  257. package/build/modern/usePrefetchQuery.cjs +1 -2
  258. package/build/modern/usePrefetchQuery.d.cts +0 -2
  259. package/build/modern/usePrefetchQuery.d.cts.map +1 -1
  260. package/build/modern/usePrefetchQuery.d.ts +0 -2
  261. package/build/modern/usePrefetchQuery.d.ts.map +1 -1
  262. package/build/modern/usePrefetchQuery.js +1 -2
  263. package/build/modern/useQueries.cjs +2 -3
  264. package/build/modern/useQueries.d.cts +0 -2
  265. package/build/modern/useQueries.d.cts.map +1 -1
  266. package/build/modern/useQueries.d.ts +0 -2
  267. package/build/modern/useQueries.d.ts.map +1 -1
  268. package/build/modern/useQueries.js +1 -2
  269. package/build/modern/useQuery.cjs +1 -2
  270. package/build/modern/useQuery.cjs.map +1 -1
  271. package/build/modern/useQuery.d.cts +5 -7
  272. package/build/modern/useQuery.d.cts.map +1 -1
  273. package/build/modern/useQuery.d.ts +5 -7
  274. package/build/modern/useQuery.d.ts.map +1 -1
  275. package/build/modern/useQuery.js +1 -2
  276. package/build/modern/useQuery.js.map +1 -1
  277. package/build/modern/useSuspenseInfiniteQuery.cjs +1 -2
  278. package/build/modern/useSuspenseInfiniteQuery.d.cts +0 -2
  279. package/build/modern/useSuspenseInfiniteQuery.d.cts.map +1 -1
  280. package/build/modern/useSuspenseInfiniteQuery.d.ts +0 -2
  281. package/build/modern/useSuspenseInfiniteQuery.d.ts.map +1 -1
  282. package/build/modern/useSuspenseInfiniteQuery.js +1 -2
  283. package/build/modern/useSuspenseQueries.cjs +1 -2
  284. package/build/modern/useSuspenseQueries.d.cts +0 -2
  285. package/build/modern/useSuspenseQueries.d.cts.map +1 -1
  286. package/build/modern/useSuspenseQueries.d.ts +0 -2
  287. package/build/modern/useSuspenseQueries.d.ts.map +1 -1
  288. package/build/modern/useSuspenseQueries.js +1 -2
  289. package/build/modern/useSuspenseQuery.cjs +1 -2
  290. package/build/modern/useSuspenseQuery.d.cts +0 -2
  291. package/build/modern/useSuspenseQuery.d.cts.map +1 -1
  292. package/build/modern/useSuspenseQuery.d.ts +0 -2
  293. package/build/modern/useSuspenseQuery.d.ts.map +1 -1
  294. package/build/modern/useSuspenseQuery.js +1 -2
  295. package/package.json +8 -8
  296. package/src/HydrationBoundary.tsx +1 -1
  297. package/src/infiniteQueryOptions.ts +15 -14
  298. package/src/queryOptions.ts +16 -13
  299. package/src/useInfiniteQuery.ts +2 -2
  300. package/src/useIsFetching.ts +1 -1
  301. package/src/useQuery.ts +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"queryOptions.js","names":[],"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n QueryKeyWithDataTag,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\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 UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\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.\n */\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\n/**\n * The options accepted by the `queryOptions` overload selected when no `initialData` is set and `queryFn` is\n * not `skipToken` — same as {@link UndefinedInitialDataOptions}, but `queryFn` may not be `skipToken`.\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 UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n /**\n * `skipToken` is not allowed as a value here — this overload is selected when no `initialData` is set. If\n * you don't intend to run the query yet, set `enabled: false` — omitting `queryFn` alone still triggers a\n * fetch that fails with \"Missing queryFn\" unless `enabled` is `false` or a default query function has been\n * defined. A default query function only supplies `queryFn`; it doesn't defer the fetch on its own.\n */\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\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 DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\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.\n */\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n /**\n * Optional here, but omitting it is only safe when no fetch will be attempted — for example with\n * `enabled: false`, or when a default query function has been defined. Otherwise, an enabled query with no\n * `queryFn` still tries to fetch and fails with a \"Missing queryFn\" error; `initialData` does not prevent this.\n */\n queryFn?: QueryFunction<TQueryFnData, 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 *\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 DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `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 * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.\n * @example\n * ```tsx\n * import { queryOptions, useQuery } from '@tanstack/react-query'\n *\n * export const postsOptions = queryOptions({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * initialData: [],\n * })\n *\n * function Posts() {\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 *\n * return (\n * <div>\n * {isError ? <span>Error: {error.message}</span> : null}\n * <ul>\n * {data.map((post) => <li key={post.id}>{post.title}</li>)}\n * </ul>\n * </div>\n * )\n * }\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> &\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 * @param options - The {@link UnusedSkipTokenOptions} 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 * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```tsx\n * import { queryOptions, useQuery } from '@tanstack/react-query'\n *\n * export const postOptions = (id: string) =>\n * queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n *\n * function Post({ id }: { id: string }) {\n * const { data, isPending, isError, error } = useQuery(postOptions(id))\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return <h1>{data.title}</h1>\n * }\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> &\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 * @param options - The {@link UndefinedInitialDataOptions} to use — everything you can pass to `useQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks This is the only overload that accepts `queryFn: skipToken`, shown below.\n * @see {@link useQuery} to run a query with these options.\n * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```tsx\n * import { queryOptions, useQuery } from '@tanstack/react-query'\n *\n * export const postOptions = (id: string) =>\n * queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n *\n * function Post({ id }: { id: string }) {\n * const { data, isPending, isError, error } = useQuery(postOptions(id))\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return <h1>{data.title}</h1>\n * }\n * ```\n * @example\n * A factory that disables the query, type safe, until `postId` is set:\n * ```tsx\n * import { queryOptions, skipToken, useQuery } from '@tanstack/react-query'\n *\n * export const postOptions = (postId: number | undefined) =>\n * queryOptions({\n * queryKey: ['post', postId],\n * queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n * })\n *\n * function Post({ postId }: { postId: number | undefined }) {\n * const { data, isLoading, isError, error } = useQuery(postOptions(postId))\n *\n * if (postId == null) return 'Select a post'\n * if (isLoading) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return <h1>{data?.title}</h1>\n * }\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAuPA,SAAgB,aAAa,SAAkB;CAC7C,OAAO;AACT"}
1
+ {"version":3,"file":"queryOptions.js","names":[],"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n QueryKeyWithDataTag,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\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 UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\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.\n */\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\n/**\n * The options accepted by the `queryOptions` overload selected when `queryFn` is not `skipToken` and\n * `initialData` is omitted, may be `undefined`, or is a function that may return `undefined` — same as\n * {@link UndefinedInitialDataOptions}, but `queryFn` may not be `skipToken`.\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 UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n /**\n * `skipToken` is not allowed as a value here — this overload is selected when `initialData` is omitted, may\n * be `undefined`, or is a function that may return `undefined`. If you don't intend to run the query yet,\n * set `enabled: false` — omitting `queryFn` alone still triggers a fetch that fails with \"Missing queryFn\"\n * unless `enabled` is `false` or a default query function has been defined. A default query function only\n * supplies `queryFn`; it doesn't defer the fetch on its own.\n */\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\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 DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\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.\n */\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n /**\n * Optional here, but omitting it is only safe when no fetch will be attempted — for example with\n * `enabled: false`, or when a default query function has been defined. Otherwise, an enabled query with no\n * `queryFn` still tries to fetch and fails with a \"Missing queryFn\" error; `initialData` does not prevent this.\n */\n queryFn?: QueryFunction<TQueryFnData, 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 *\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 DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, 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 * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.\n * @example\n * ```tsx\n * import { queryOptions, useQuery } from '@tanstack/react-query'\n *\n * export const postsOptions = queryOptions({\n * queryKey: ['posts'],\n * queryFn: fetchPosts,\n * initialData: [],\n * })\n *\n * function Posts() {\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 *\n * return (\n * <div>\n * {isError ? <span>Error: {error.message}</span> : null}\n * <ul>\n * {data.map((post) => <li key={post.id}>{post.title}</li>)}\n * </ul>\n * </div>\n * )\n * }\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> &\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 * @param options - The {@link UnusedSkipTokenOptions} 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 * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```tsx\n * import { queryOptions, useQuery } from '@tanstack/react-query'\n *\n * export const postOptions = (id: string) =>\n * queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n *\n * function Post({ id }: { id: string }) {\n * const { data, isPending, isError, error } = useQuery(postOptions(id))\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return <h1>{data.title}</h1>\n * }\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> &\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 * @param options - The {@link UndefinedInitialDataOptions} to use — everything you can pass to `useQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks This is the only overload that accepts `queryFn: skipToken`, shown below.\n * @see {@link useQuery} to run a query with these options.\n * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.\n * @example\n * A parameterized factory, so the same options object can be reused per `id`:\n * ```tsx\n * import { queryOptions, useQuery } from '@tanstack/react-query'\n *\n * export const postOptions = (id: string) =>\n * queryOptions({\n * queryKey: ['post', id],\n * queryFn: () => fetchPost(id),\n * })\n *\n * function Post({ id }: { id: string }) {\n * const { data, isPending, isError, error } = useQuery(postOptions(id))\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return <h1>{data.title}</h1>\n * }\n * ```\n * @example\n * A factory that disables the query, type safe, until `postId` is set:\n * ```tsx\n * import { queryOptions, skipToken, useQuery } from '@tanstack/react-query'\n *\n * export const postOptions = (postId: number | undefined) =>\n * queryOptions({\n * queryKey: ['post', postId],\n * queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n * })\n *\n * function Post({ postId }: { postId: number | undefined }) {\n * const { data, isLoading, isError, error } = useQuery(postOptions(postId))\n *\n * if (postId == null) return 'Select a post'\n * if (isLoading) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return <h1>{data?.title}</h1>\n * }\n * ```\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> &\n QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AA0PA,SAAgB,aAAa,SAAkB;CAC7C,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,7 +19,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
19
  value: mod,
20
20
  enumerable: true
21
21
  }) : target, mod));
22
- //#endregion
23
22
  Object.defineProperty(exports, "__toESM", {
24
23
  enumerable: true,
25
24
  get: function() {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/suspense.ts
2
+ // src/suspense.ts
3
3
  /**
4
4
  * The default `throwOnError` of the suspense hooks: throws the error to the nearest error boundary
5
5
  * only if the query has no data to show.
@@ -41,7 +41,6 @@ const shouldSuspend = (defaultedOptions, result) => (defaultedOptions === null |
41
41
  const fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
42
42
  errorResetBoundary.clearReset();
43
43
  });
44
- //#endregion
45
44
  exports.defaultThrowOnError = defaultThrowOnError;
46
45
  exports.ensureSuspenseTimers = ensureSuspenseTimers;
47
46
  exports.fetchOptimistic = fetchOptimistic;
@@ -1,6 +1,5 @@
1
1
  import { QueryErrorResetBoundaryValue } from "./QueryErrorResetBoundary.cjs";
2
2
  import { DefaultError, DefaultedQueryObserverOptions, Query, QueryKey, QueryObserver, QueryObserverResult } from "@tanstack/query-core";
3
- //#region src/suspense.d.ts
4
3
  /**
5
4
  * The default `throwOnError` of the suspense hooks: throws the error to the nearest error boundary
6
5
  * only if the query has no data to show.
@@ -32,5 +31,4 @@ export declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOpt
32
31
  * @returns A promise that resolves once the fetch settles. It never rejects.
33
32
  */
34
33
  export declare const fetchOptimistic: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(defaultedOptions: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => Promise<void | QueryObserverResult<TData, TError>>;
35
- //#endregion
36
34
  //# sourceMappingURL=suspense.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suspense.d.cts","names":[],"sources":["../../src/suspense.ts"],"mappings":";;;;;;;;;;qBAiBa,sBACX,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,QAAQ,QACR,OAAO,MAAM,cAAc,QAAQ,OAAO;;;;;;;qBAS/B,uBACX,kBAAkB;;;;;;;qBAiCP,gBACX,kBACI,oEAEJ,QAAQ;;;;;;;;;qBAWG,kBACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,kBAAkB,8BAChB,cACA,QACA,OACA,YACA,YAEF,UAAU,cAAc,cAAc,QAAQ,OAAO,YAAY,YACjE,oBAAoB,iCAA4B,eAAA,oBAAA,OAAA"}
1
+ {"version":3,"file":"suspense.d.cts","names":[],"sources":["../../src/suspense.ts"],"mappings":";;;;;;;;;qBAiBa,sBACX,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,QAAQ,QACR,OAAO,MAAM,cAAc,QAAQ,OAAO;;;;;;;qBAS/B,uBACX,kBAAkB;;;;;;;qBAiCP,gBACX,kBACI,oEAEJ,QAAQ;;;;;;;;;qBAWG,kBACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,kBAAkB,8BAChB,cACA,QACA,OACA,YACA,YAEF,UAAU,cAAc,cAAc,QAAQ,OAAO,YAAY,YACjE,oBAAoB,iCAA4B,eAAA,oBAAA,OAAA"}
@@ -1,6 +1,5 @@
1
1
  import { QueryErrorResetBoundaryValue } from "./QueryErrorResetBoundary.js";
2
2
  import { DefaultError, DefaultedQueryObserverOptions, Query, QueryKey, QueryObserver, QueryObserverResult } from "@tanstack/query-core";
3
- //#region src/suspense.d.ts
4
3
  /**
5
4
  * The default `throwOnError` of the suspense hooks: throws the error to the nearest error boundary
6
5
  * only if the query has no data to show.
@@ -32,5 +31,4 @@ export declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOpt
32
31
  * @returns A promise that resolves once the fetch settles. It never rejects.
33
32
  */
34
33
  export declare const fetchOptimistic: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(defaultedOptions: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => Promise<void | QueryObserverResult<TData, TError>>;
35
- //#endregion
36
34
  //# sourceMappingURL=suspense.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suspense.d.ts","names":[],"sources":["../../src/suspense.ts"],"mappings":";;;;;;;;;;qBAiBa,sBACX,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,QAAQ,QACR,OAAO,MAAM,cAAc,QAAQ,OAAO;;;;;;;qBAS/B,uBACX,kBAAkB;;;;;;;qBAiCP,gBACX,kBACI,oEAEJ,QAAQ;;;;;;;;;qBAWG,kBACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,kBAAkB,8BAChB,cACA,QACA,OACA,YACA,YAEF,UAAU,cAAc,cAAc,QAAQ,OAAO,YAAY,YACjE,oBAAoB,iCAA4B,eAAA,oBAAA,OAAA"}
1
+ {"version":3,"file":"suspense.d.ts","names":[],"sources":["../../src/suspense.ts"],"mappings":";;;;;;;;;qBAiBa,sBACX,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,UAE7B,QAAQ,QACR,OAAO,MAAM,cAAc,QAAQ,OAAO;;;;;;;qBAS/B,uBACX,kBAAkB;;;;;;;qBAiCP,gBACX,kBACI,oEAEJ,QAAQ;;;;;;;;;qBAWG,kBACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,kBAAkB,8BAChB,cACA,QACA,OACA,YACA,YAEF,UAAU,cAAc,cAAc,QAAQ,OAAO,YAAY,YACjE,oBAAoB,iCAA4B,eAAA,oBAAA,OAAA"}
@@ -1,4 +1,4 @@
1
- //#region src/suspense.ts
1
+ // src/suspense.ts
2
2
  /**
3
3
  * The default `throwOnError` of the suspense hooks: throws the error to the nearest error boundary
4
4
  * only if the query has no data to show.
@@ -40,7 +40,6 @@ const shouldSuspend = (defaultedOptions, result) => (defaultedOptions === null |
40
40
  const fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
41
41
  errorResetBoundary.clearReset();
42
42
  });
43
- //#endregion
44
43
  export { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend };
45
44
 
46
45
  //# sourceMappingURL=suspense.js.map
@@ -1,5 +1,4 @@
1
- //#region src/types.ts
1
+ // src/types.ts
2
2
  /* istanbul ignore file */
3
- //#endregion
4
3
 
5
4
  //# sourceMappingURL=types.cjs.map
@@ -1,5 +1,4 @@
1
1
  import { DefaultError, DefinedInfiniteQueryObserverResult, DefinedQueryObserverResult, DistributiveOmit, InfiniteData, InfiniteQueryExecuteOptions, InfiniteQueryObserverOptions, InfiniteQueryObserverResult, MutateFunction, MutationObserverOptions, MutationObserverResult, OmitKeyof, Override, QueryExecuteOptions, QueryKey, QueryObserverOptions, QueryObserverResult, SkipToken } from "@tanstack/query-core";
2
- //#region src/types.d.ts
3
2
  /**
4
3
  * {@link UseBaseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
5
4
  * relevant, e.g. when accepting options for any query in a helper function.
@@ -256,5 +255,4 @@ export type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVaria
256
255
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
257
256
  */
258
257
  export type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
259
- //#endregion
260
258
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;;YA2BY,yBAAyB;;;;;;;;;;;;iBAkBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;EAMA;;;;;;;;;;;;;YAcU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,YACA,uBAEF;;;;;;;;;;;;;YAeQ,gCACV,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;YAQQ,qBAAqB;;;;;;;;;;iBAUhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;YAQrD,6BAA6B;;;;;;;;;;;iBAgBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;YAQQ,6BAA6B;;;;;;;;;;;;iBAkBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;EAQF;;;;;;YAOU,qCACV;;;;;;;;;;;;iBAYe,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;YAWQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;YAOnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;YAQlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;YAWxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;YAQ1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;YAS3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;YAQlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;YAQhC,wBAAwB;;;;;;;;;;iBAUnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;YAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAalC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAWlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;YAYQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;YA2BY,yBAAyB;;;;;;;;;;;;iBAkBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;EAMA;;;;;;;;;;;;;YAcU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,YACA,uBAEF;;;;;;;;;;;;;YAeQ,gCACV,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;YAQQ,qBAAqB;;;;;;;;;;iBAUhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;YAQrD,6BAA6B;;;;;;;;;;;iBAgBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;YAQQ,6BAA6B;;;;;;;;;;;;iBAkBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;EAQF;;;;;;YAOU,qCACV;;;;;;;;;;;;iBAYe,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;YAWQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;YAOnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;YAQlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;YAWxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;YAQ1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;YAS3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;YAQlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;YAQhC,wBAAwB;;;;;;;;;;iBAUnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;YAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAalC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAWlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;YAYQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
@@ -1,5 +1,4 @@
1
1
  import { DefaultError, DefinedInfiniteQueryObserverResult, DefinedQueryObserverResult, DistributiveOmit, InfiniteData, InfiniteQueryExecuteOptions, InfiniteQueryObserverOptions, InfiniteQueryObserverResult, MutateFunction, MutationObserverOptions, MutationObserverResult, OmitKeyof, Override, QueryExecuteOptions, QueryKey, QueryObserverOptions, QueryObserverResult, SkipToken } from "@tanstack/query-core";
2
- //#region src/types.d.ts
3
2
  /**
4
3
  * {@link UseBaseQueryOptions} with all type parameters set to `any`, useful when the specific types aren't
5
4
  * relevant, e.g. when accepting options for any query in a helper function.
@@ -256,5 +255,4 @@ export type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVaria
256
255
  * their `onMutateResult` parameter — useful for optimistic-update rollback data.
257
256
  */
258
257
  export type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>;
259
- //#endregion
260
258
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;;YA2BY,yBAAyB;;;;;;;;;;;;iBAkBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;EAMA;;;;;;;;;;;;;YAcU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,YACA,uBAEF;;;;;;;;;;;;;YAeQ,gCACV,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;YAQQ,qBAAqB;;;;;;;;;;iBAUhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;YAQrD,6BAA6B;;;;;;;;;;;iBAgBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;YAQQ,6BAA6B;;;;;;;;;;;;iBAkBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;EAQF;;;;;;YAOU,qCACV;;;;;;;;;;;;iBAYe,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;YAWQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;YAOnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;YAQlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;YAWxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;YAQ1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;YAS3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;YAQlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;YAQhC,wBAAwB;;;;;;;;;;iBAUnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;YAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAalC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAWlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;YAYQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;YA2BY,yBAAyB;;;;;;;;;;;;iBAkBpB,oBACf,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,kBACrB,qBACR,cACA,QACA,OACA,YACA;;;;;EAMA;;;;;;;;;;;;;YAcU,wBACV,wBACA,SAAS,cACT,QAAQ,cACR,aAAa,cACb,kBAAkB,WAAW,YAC3B,iBACF,oBAAoB,cAAc,QAAQ,OAAO,YAAY;;;;;EAO7D,UAAU,QACR,oBACE,cACA,QACA,OACA,YACA,uBAEF;;;;;;;;;;;;;YAeQ,gCACV,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,iBACF,4BACE,cACA,QACA,OACA,WACA;;;;;EAQF,UAAU,QACR,4BACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;YAQQ,qBAAqB;;;;;;;;;;iBAUhB,gBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,oBAAoB,cAAc,QAAQ,OAAO,cAAc;;;;;YAQrD,6BAA6B;;;;;;;;;;;iBAgBxB,wBACf,wBACA,SAAS,cACT,QAAQ,cACR,kBAAkB,WAAW,kBACrB,UACR,gBAAgB,cAAc,QAAQ,OAAO;;;;;EAO7C,UAAU,QACR,gBAAgB,cAAc,QAAQ,OAAO,uBAC7C;;;;;;YAQQ,6BAA6B;;;;;;;;;;;;iBAkBxB,wBACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,6BACE,cACA,QACA,OACA,WACA;;;;;EAQF;;;;;;YAOU,qCACV;;;;;;;;;;;;iBAYe,gCACf,wBACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,8BACQ,UACR,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;EAOhE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;YAWQ,mBACV,iBACA,SAAS,gBACP,oBAAoB,OAAO;;;;;;YAOnB,eACV,iBACA,SAAS,gBACP,mBAAmB,OAAO;;;;;;;YAQlB,uBACV,iBACA,SAAS,gBACP,iBACF,2BAA2B,OAAO;;;;;;;;YAWxB,sBACV,iBACA,SAAS,gBACP,2BAA2B,OAAO;;;;;;;YAQ1B,uBACV,iBACA,SAAS,gBACP,4BAA4B,OAAO;;;;;;;;YAS3B,8BACV,iBACA,SAAS,gBACP,mCAAmC,OAAO;;;;;;;YAQlC,+BACV,iBACA,SAAS,gBACP,UACF,mCAAmC,OAAO;;;;;YAQhC,wBAAwB;;;;;;;;;;iBAUnB,mBACf,iBACA,SAAS,cACT,mBACA,mCACQ,UACR,wBAAwB,OAAO,QAAQ,YAAY;;;;;;;;;;;;YAezC,kBACV,iBACA,SAAS,cACT,mBACA,iCAEG,MAAM,WACP,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAalC,uBACV,iBACA,SAAS,cACT,mBACA,6BACE,eAAe,OAAO,QAAQ,YAAY;;;;;;;;;;YAWlC,sBACV,iBACA,SAAS,cACT,sBACA,6BACE,SACF,uBAAuB,OAAO,QAAQ,YAAY;EAChD,QAAQ,kBAAkB,OAAO,QAAQ,YAAY;;;;;EAKvD,aAAa,uBACX,OACA,QACA,YACA;;;;;;;;;;YAYQ,kBACV,iBACA,SAAS,cACT,sBACA,6BACE,sBAAsB,OAAO,QAAQ,YAAY"}
@@ -1,6 +1,5 @@
1
- //#region src/types.ts
1
+ // src/types.ts
2
2
  /* istanbul ignore file */
3
- //#endregion
4
3
  export {};
5
4
 
6
5
  //# sourceMappingURL=types.js.map
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
3
+ const require_rolldown_runtime = require("./rolldown-runtime-CmQyd0Gu.cjs");
4
4
  const require_QueryClientProvider = require("./QueryClientProvider.cjs");
5
5
  const require_IsRestoringProvider = require("./IsRestoringProvider.cjs");
6
6
  const require_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs");
@@ -9,7 +9,7 @@ const require_suspense = require("./suspense.cjs");
9
9
  let react = require("react");
10
10
  react = require_rolldown_runtime.__toESM(react, 1);
11
11
  let _tanstack_query_core = require("@tanstack/query-core");
12
- //#region src/useBaseQuery.ts
12
+ // src/useBaseQuery.ts
13
13
  /**
14
14
  * Base implementation shared by `useQuery`, `useInfiniteQuery`, `useSuspenseQuery`, and
15
15
  * `useSuspenseInfiniteQuery`.
@@ -61,7 +61,6 @@ function useBaseQuery(options, Observer, queryClient) {
61
61
  })) throw result.error;
62
62
  return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
63
63
  }
64
- //#endregion
65
64
  exports.useBaseQuery = useBaseQuery;
66
65
 
67
66
  //# sourceMappingURL=useBaseQuery.cjs.map
@@ -1,6 +1,5 @@
1
1
  import { UseBaseQueryOptions } from "./types.cjs";
2
2
  import { QueryClient, QueryKey, QueryObserver, QueryObserverResult } from "@tanstack/query-core";
3
- //#region src/useBaseQuery.d.ts
4
3
  /**
5
4
  * Base implementation shared by `useQuery`, `useInfiniteQuery`, `useSuspenseQuery`, and
6
5
  * `useSuspenseInfiniteQuery`.
@@ -15,5 +14,4 @@ import { QueryClient, QueryKey, QueryObserver, QueryObserverResult } from "@tans
15
14
  * thrown to the nearest error boundary (see `throwOnError`). While suspending, it throws a promise instead.
16
15
  */
17
16
  export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, Observer: typeof QueryObserver, queryClient?: QueryClient): QueryObserverResult<TData, TError>;
18
- //#endregion
19
17
  //# sourceMappingURL=useBaseQuery.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuery.d.cts","names":[],"sources":["../../src/useBaseQuery.ts"],"mappings":";;;;;;;;;;;;;;;;wBAsCgB,aACd,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,oBACP,cACA,QACA,OACA,YACA,YAEF,iBAAiB,eACjB,cAAc,cACb,oBAAoB,OAAO"}
1
+ {"version":3,"file":"useBaseQuery.d.cts","names":[],"sources":["../../src/useBaseQuery.ts"],"mappings":";;;;;;;;;;;;;;;wBAsCgB,aACd,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,oBACP,cACA,QACA,OACA,YACA,YAEF,iBAAiB,eACjB,cAAc,cACb,oBAAoB,OAAO"}
@@ -1,6 +1,5 @@
1
1
  import { UseBaseQueryOptions } from "./types.js";
2
2
  import { QueryClient, QueryKey, QueryObserver, QueryObserverResult } from "@tanstack/query-core";
3
- //#region src/useBaseQuery.d.ts
4
3
  /**
5
4
  * Base implementation shared by `useQuery`, `useInfiniteQuery`, `useSuspenseQuery`, and
6
5
  * `useSuspenseInfiniteQuery`.
@@ -15,5 +14,4 @@ import { QueryClient, QueryKey, QueryObserver, QueryObserverResult } from "@tans
15
14
  * thrown to the nearest error boundary (see `throwOnError`). While suspending, it throws a promise instead.
16
15
  */
17
16
  export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, Observer: typeof QueryObserver, queryClient?: QueryClient): QueryObserverResult<TData, TError>;
18
- //#endregion
19
17
  //# sourceMappingURL=useBaseQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuery.d.ts","names":[],"sources":["../../src/useBaseQuery.ts"],"mappings":";;;;;;;;;;;;;;;;wBAsCgB,aACd,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,oBACP,cACA,QACA,OACA,YACA,YAEF,iBAAiB,eACjB,cAAc,cACb,oBAAoB,OAAO"}
1
+ {"version":3,"file":"useBaseQuery.d.ts","names":[],"sources":["../../src/useBaseQuery.ts"],"mappings":";;;;;;;;;;;;;;;wBAsCgB,aACd,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,oBACP,cACA,QACA,OACA,YACA,YAEF,iBAAiB,eACjB,cAAc,cACb,oBAAoB,OAAO"}
@@ -6,7 +6,7 @@ import { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundar
6
6
  import { ensureSuspenseTimers, fetchOptimistic, shouldSuspend } from "./suspense.js";
7
7
  import * as React from "react";
8
8
  import { noop, notifyManager } from "@tanstack/query-core";
9
- //#region src/useBaseQuery.ts
9
+ // src/useBaseQuery.ts
10
10
  /**
11
11
  * Base implementation shared by `useQuery`, `useInfiniteQuery`, `useSuspenseQuery`, and
12
12
  * `useSuspenseInfiniteQuery`.
@@ -58,7 +58,6 @@ function useBaseQuery(options, Observer, queryClient) {
58
58
  })) throw result.error;
59
59
  return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
60
60
  }
61
- //#endregion
62
61
  export { useBaseQuery };
63
62
 
64
63
  //# sourceMappingURL=useBaseQuery.js.map
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_useBaseQuery = require("./useBaseQuery.cjs");
4
4
  let _tanstack_query_core = require("@tanstack/query-core");
5
- //#region src/useInfiniteQuery.ts
5
+ // src/useInfiniteQuery.ts
6
6
  function useInfiniteQuery(options, queryClient) {
7
7
  return require_useBaseQuery.useBaseQuery(options, _tanstack_query_core.InfiniteQueryObserver, queryClient);
8
8
  }
9
- //#endregion
10
9
  exports.useInfiniteQuery = useInfiniteQuery;
11
10
 
12
11
  //# sourceMappingURL=useInfiniteQuery.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInfiniteQuery.cjs","names":["useBaseQuery","InfiniteQueryObserver"],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\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.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\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 *\n * return (\n * <div>\n * {isError ? <span>Error: {error.message}</span> : null}\n * <ul>\n * {data.pages.map((page) => page.projects.map((p) => <li key={p.id}>{p.name}</li>))}\n * </ul>\n * </div>\n * )\n * }\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: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\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: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UseInfiniteQueryOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\n * ```\n * @example\n * A query that's disabled, type safe, until `postId` is set — pass `skipToken` as `queryFn`\n * instead of setting `enabled: false`:\n * ```tsx\n * import { skipToken, useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Comments({ postId }: { postId: string | undefined }) {\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 * 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 * if (postId == null) return 'Select a post'\n * if (isLoading) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <ul>\n * {data?.pages.map((page) => page.comments.map((c) => <li key={c.id}>{c.text}</li>))}\n * </ul>\n * )\n * }\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: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;;AAkWA,SAAgB,iBACd,SACA,aACA;CACA,OAAOA,qBAAAA,aACL,SACAC,qBAAAA,uBACA,WACF;AACF"}
1
+ {"version":3,"file":"useInfiniteQuery.cjs","names":["useBaseQuery","InfiniteQueryObserver"],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\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.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` known to be defined.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\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 *\n * return (\n * <div>\n * {isError ? <span>Error: {error.message}</span> : null}\n * <ul>\n * {data.pages.map((page) => page.projects.map((p) => <li key={p.id}>{p.name}</li>))}\n * </ul>\n * </div>\n * )\n * }\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: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\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: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UseInfiniteQueryOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\n * ```\n * @example\n * A query that's disabled, type safe, until `postId` is set — pass `skipToken` as `queryFn`\n * instead of setting `enabled: false`:\n * ```tsx\n * import { skipToken, useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Comments({ postId }: { postId: string | undefined }) {\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 * 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 * if (postId == null) return 'Select a post'\n * if (isLoading) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <ul>\n * {data?.pages.map((page) => page.comments.map((c) => <li key={c.id}>{c.text}</li>))}\n * </ul>\n * )\n * }\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: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;;AAkWA,SAAgB,iBACd,SACA,aACA;CACA,OAAOA,qBAAAA,aACL,SACAC,qBAAAA,uBACA,WACF;AACF"}
@@ -1,13 +1,12 @@
1
1
  import { DefinedUseInfiniteQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult } from "./types.cjs";
2
2
  import { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from "./infiniteQueryOptions.cjs";
3
3
  import { DefaultError, InfiniteData, QueryClient, QueryKey } from "@tanstack/query-core";
4
- //#region src/useInfiniteQuery.d.ts
5
4
  /**
6
5
  * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of
7
6
  * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
8
7
  *
9
- * This overload is selected when `initialData` is set.
10
- * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.
8
+ * This overload is selected when `initialData` is known to be defined.
9
+ * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` known to be defined.
11
10
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
12
11
  * be used.
13
12
  * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
@@ -288,5 +287,4 @@ export declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TD
288
287
  * ```
289
288
  */
290
289
  export declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>;
291
- //#endregion
292
290
  //# sourceMappingURL=useInfiniteQuery.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInfiniteQuery.d.cts","names":[],"sources":["../../src/useInfiniteQuery.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8DgB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,8BAA8B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4GxB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyIjB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,wBACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO"}
1
+ {"version":3,"file":"useInfiniteQuery.d.cts","names":[],"sources":["../../src/useInfiniteQuery.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8DgB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,8BAA8B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4GxB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyIjB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,wBACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO"}
@@ -1,13 +1,12 @@
1
1
  import { DefinedUseInfiniteQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult } from "./types.js";
2
2
  import { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from "./infiniteQueryOptions.js";
3
3
  import { DefaultError, InfiniteData, QueryClient, QueryKey } from "@tanstack/query-core";
4
- //#region src/useInfiniteQuery.d.ts
5
4
  /**
6
5
  * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of
7
6
  * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
8
7
  *
9
- * This overload is selected when `initialData` is set.
10
- * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.
8
+ * This overload is selected when `initialData` is known to be defined.
9
+ * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` known to be defined.
11
10
  * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
12
11
  * be used.
13
12
  * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
@@ -288,5 +287,4 @@ export declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TD
288
287
  * ```
289
288
  */
290
289
  export declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>;
291
- //#endregion
292
290
  //# sourceMappingURL=useInfiniteQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInfiniteQuery.d.ts","names":[],"sources":["../../src/useInfiniteQuery.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8DgB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,8BAA8B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4GxB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyIjB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,wBACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO"}
1
+ {"version":3,"file":"useInfiniteQuery.d.ts","names":[],"sources":["../../src/useInfiniteQuery.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8DgB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,8BAA8B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4GxB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyIjB,iBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,wBACP,cACA,QACA,OACA,WACA,aAEF,cAAc,cACb,uBAAuB,OAAO"}
@@ -1,11 +1,10 @@
1
1
  "use client";
2
2
  import { useBaseQuery } from "./useBaseQuery.js";
3
3
  import { InfiniteQueryObserver } from "@tanstack/query-core";
4
- //#region src/useInfiniteQuery.ts
4
+ // src/useInfiniteQuery.ts
5
5
  function useInfiniteQuery(options, queryClient) {
6
6
  return useBaseQuery(options, InfiniteQueryObserver, queryClient);
7
7
  }
8
- //#endregion
9
8
  export { useInfiniteQuery };
10
9
 
11
10
  //# sourceMappingURL=useInfiniteQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInfiniteQuery.js","names":[],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\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.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\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 *\n * return (\n * <div>\n * {isError ? <span>Error: {error.message}</span> : null}\n * <ul>\n * {data.pages.map((page) => page.projects.map((p) => <li key={p.id}>{p.name}</li>))}\n * </ul>\n * </div>\n * )\n * }\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: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\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: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UseInfiniteQueryOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\n * ```\n * @example\n * A query that's disabled, type safe, until `postId` is set — pass `skipToken` as `queryFn`\n * instead of setting `enabled: false`:\n * ```tsx\n * import { skipToken, useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Comments({ postId }: { postId: string | undefined }) {\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 * 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 * if (postId == null) return 'Select a post'\n * if (isLoading) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <ul>\n * {data?.pages.map((page) => page.comments.map((c) => <li key={c.id}>{c.text}</li>))}\n * </ul>\n * )\n * }\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: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;AAkWA,SAAgB,iBACd,SACA,aACA;CACA,OAAO,aACL,SACA,uBACA,WACF;AACF"}
1
+ {"version":3,"file":"useInfiniteQuery.js","names":[],"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\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.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` known to be defined.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\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 *\n * return (\n * <div>\n * {isError ? <span>Error: {error.message}</span> : null}\n * <ul>\n * {data.pages.map((page) => page.projects.map((p) => <li key={p.id}>{p.name}</li>))}\n * </ul>\n * </div>\n * )\n * }\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: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\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: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\n/**\n * The options for `useInfiniteQuery` are identical to `useQuery`, with the addition of\n * `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.\n * @param options - The {@link UseInfiniteQueryOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns The same properties as `useQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,\n * `hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data.pages` and\n * `data.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 * @see {@link infiniteQueryOptions} to share these options between `useInfiniteQuery` and imperative APIs like `queryClient.infiniteQuery`.\n * @example\n * Fetching the next page from a \"Load More\" button click:\n * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Projects() {\n * const { data, isPending, isError, error, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage } =\n * useInfiniteQuery({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <button\n * onClick={() => fetchNextPage()}\n * disabled={!hasNextPage || isFetching}\n * >\n * {isFetchingNextPage\n * ? 'Loading more...'\n * : hasNextPage\n * ? 'Load More'\n * : 'Nothing more to load'}\n * </button>\n * </>\n * )\n * }\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 * ```tsx\n * import { useInfiniteQuery } from '@tanstack/react-query'\n * import { useEffect, useRef } from 'react'\n *\n * function Projects() {\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 sentinelRef = useRef<HTMLDivElement>(null)\n *\n * useEffect(() => {\n * const sentinel = sentinelRef.current\n * if (sentinel == null || !hasNextPage || isFetching) return\n *\n * const observer = new IntersectionObserver(([entry]) => {\n * if (entry?.isIntersecting) fetchNextPage()\n * })\n * observer.observe(sentinel)\n *\n * return () => observer.disconnect()\n * }, [hasNextPage, isFetching, fetchNextPage])\n *\n * if (isPending) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <>\n * <ul>\n * {data.pages.map((page) =>\n * page.projects.map((project) => <li key={project.id}>{project.name}</li>),\n * )}\n * </ul>\n * <div ref={sentinelRef}>{isFetchingNextPage ? 'Loading more...' : null}</div>\n * </>\n * )\n * }\n * ```\n * @example\n * A query that's disabled, type safe, until `postId` is set — pass `skipToken` as `queryFn`\n * instead of setting `enabled: false`:\n * ```tsx\n * import { skipToken, useInfiniteQuery } from '@tanstack/react-query'\n *\n * function Comments({ postId }: { postId: string | undefined }) {\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 * 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 * if (postId == null) return 'Select a post'\n * if (isLoading) return 'Loading...'\n * if (isError) return <span>Error: {error.message}</span>\n *\n * return (\n * <ul>\n * {data?.pages.map((page) => page.comments.map((c) => <li key={c.id}>{c.text}</li>))}\n * </ul>\n * )\n * }\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: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;AAkWA,SAAgB,iBACd,SACA,aACA;CACA,OAAO,aACL,SACA,uBACA,WACF;AACF"}
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
3
+ const require_rolldown_runtime = require("./rolldown-runtime-CmQyd0Gu.cjs");
4
4
  const require_QueryClientProvider = require("./QueryClientProvider.cjs");
5
5
  let react = require("react");
6
6
  react = require_rolldown_runtime.__toESM(react, 1);
7
7
  let _tanstack_query_core = require("@tanstack/query-core");
8
- //#region src/useIsFetching.ts
8
+ // src/useIsFetching.ts
9
9
  /**
10
10
  * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in
11
11
  * the background (useful for app-wide loading indicators).
@@ -44,7 +44,6 @@ function useIsFetching(filters, queryClient) {
44
44
  const queryCache = client.getQueryCache();
45
45
  return react.useSyncExternalStore(react.useCallback((onStoreChange) => queryCache.subscribe(_tanstack_query_core.notifyManager.batchCalls(onStoreChange)), [queryCache]), () => client.isFetching(filters), () => client.isFetching(filters));
46
46
  }
47
- //#endregion
48
47
  exports.useIsFetching = useIsFetching;
49
48
 
50
49
  //# sourceMappingURL=useIsFetching.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsFetching.cjs","names":["useQueryClient","React","notifyManager"],"sources":["../../src/useIsFetching.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { notifyManager } from '@tanstack/query-core'\n\nimport { useQueryClient } from './QueryClientProvider'\nimport type { QueryClient, QueryFilters } from '@tanstack/query-core'\n\n/**\n * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in\n * the background (useful for app-wide loading indicators).\n * @param filters - The {@link QueryFilters} to narrow down the matched queries.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns Will be the `number` of the queries that your application is currently loading or fetching in the\n * background.\n * @example\n * ```tsx\n * import { useIsFetching } from '@tanstack/react-query'\n *\n * function PostsFetchingIndicator() {\n * // How many queries matching the posts prefix are fetching?\n * const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })\n *\n * return isFetchingPosts ? <span>Refreshing posts...</span> : null\n * }\n * ```\n * @example\n * A global loading indicator for any query fetching in the background, not just the ones on screen:\n * ```tsx\n * import { useIsFetching } from '@tanstack/react-query'\n *\n * function GlobalLoadingIndicator() {\n * const isFetching = useIsFetching()\n *\n * return isFetching ? (\n * <div>Queries are fetching in the background...</div>\n * ) : null\n * }\n * ```\n */\nexport function useIsFetching(\n filters?: QueryFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n const queryCache = client.getQueryCache()\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),\n [queryCache],\n ),\n () => client.isFetching(filters),\n () => client.isFetching(filters),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,cACd,SACA,aACQ;CACR,MAAM,SAASA,4BAAAA,eAAe,WAAW;CACzC,MAAM,aAAa,OAAO,cAAc;CAExC,OAAOC,MAAM,qBACXA,MAAM,aACH,kBACC,WAAW,UAAUC,qBAAAA,cAAc,WAAW,aAAa,CAAC,GAC9D,CAAC,UAAU,CACb,SACM,OAAO,WAAW,OAAO,SACzB,OAAO,WAAW,OAAO,CACjC;AACF"}
1
+ {"version":3,"file":"useIsFetching.cjs","names":["useQueryClient","React","notifyManager"],"sources":["../../src/useIsFetching.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { notifyManager } from '@tanstack/query-core'\n\nimport { useQueryClient } from './QueryClientProvider'\nimport type { QueryClient, QueryFilters } from '@tanstack/query-core'\n\n/**\n * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in\n * the background (useful for app-wide loading indicators).\n * @param filters - The {@link QueryFilters} to narrow down the matched queries.\n * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n * be used.\n * @returns Will be the `number` of the queries that your application is currently loading or fetching in the\n * background.\n * @example\n * ```tsx\n * import { useIsFetching } from '@tanstack/react-query'\n *\n * function PostsFetchingIndicator() {\n * // How many queries matching the posts prefix are fetching?\n * const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })\n *\n * return isFetchingPosts ? <span>Refreshing posts...</span> : null\n * }\n * ```\n * @example\n * A global loading indicator for any query fetching in the background, not just the ones on screen:\n * ```tsx\n * import { useIsFetching } from '@tanstack/react-query'\n *\n * function GlobalLoadingIndicator() {\n * const isFetching = useIsFetching()\n *\n * return isFetching ? (\n * <div>Queries are fetching in the background...</div>\n * ) : null\n * }\n * ```\n */\nexport function useIsFetching(\n filters?: Omit<QueryFilters, 'fetchStatus'>,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n const queryCache = client.getQueryCache()\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),\n [queryCache],\n ),\n () => client.isFetching(filters),\n () => client.isFetching(filters),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,cACd,SACA,aACQ;CACR,MAAM,SAASA,4BAAAA,eAAe,WAAW;CACzC,MAAM,aAAa,OAAO,cAAc;CAExC,OAAOC,MAAM,qBACXA,MAAM,aACH,kBACC,WAAW,UAAUC,qBAAAA,cAAc,WAAW,aAAa,CAAC,GAC9D,CAAC,UAAU,CACb,SACM,OAAO,WAAW,OAAO,SACzB,OAAO,WAAW,OAAO,CACjC;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { QueryClient, QueryFilters } from "@tanstack/query-core";
2
- //#region src/useIsFetching.d.ts
3
2
  /**
4
3
  * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in
5
4
  * the background (useful for app-wide loading indicators).
@@ -33,6 +32,5 @@ import { QueryClient, QueryFilters } from "@tanstack/query-core";
33
32
  * }
34
33
  * ```
35
34
  */
36
- export declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number;
37
- //#endregion
35
+ export declare function useIsFetching(filters?: Omit<QueryFilters, 'fetchStatus'>, queryClient?: QueryClient): number;
38
36
  //# sourceMappingURL=useIsFetching.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsFetching.d.cts","names":[],"sources":["../../src/useIsFetching.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCgB,cACd,UAAU,cACV,cAAc"}
1
+ {"version":3,"file":"useIsFetching.d.cts","names":[],"sources":["../../src/useIsFetching.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCgB,cACd,UAAU,KAAK,8BACf,cAAc"}
@@ -1,5 +1,4 @@
1
1
  import { QueryClient, QueryFilters } from "@tanstack/query-core";
2
- //#region src/useIsFetching.d.ts
3
2
  /**
4
3
  * The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in
5
4
  * the background (useful for app-wide loading indicators).
@@ -33,6 +32,5 @@ import { QueryClient, QueryFilters } from "@tanstack/query-core";
33
32
  * }
34
33
  * ```
35
34
  */
36
- export declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number;
37
- //#endregion
35
+ export declare function useIsFetching(filters?: Omit<QueryFilters, 'fetchStatus'>, queryClient?: QueryClient): number;
38
36
  //# sourceMappingURL=useIsFetching.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsFetching.d.ts","names":[],"sources":["../../src/useIsFetching.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCgB,cACd,UAAU,cACV,cAAc"}
1
+ {"version":3,"file":"useIsFetching.d.ts","names":[],"sources":["../../src/useIsFetching.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCgB,cACd,UAAU,KAAK,8BACf,cAAc"}