@tanstack/react-query 5.104.1 → 5.104.3

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 (347) 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 +2 -3
  4. package/build/legacy/HydrationBoundary.d.cts.map +1 -1
  5. package/build/legacy/HydrationBoundary.d.ts +2 -3
  6. package/build/legacy/HydrationBoundary.d.ts.map +1 -1
  7. package/build/legacy/HydrationBoundary.js +2 -3
  8. package/build/legacy/HydrationBoundary.js.map +1 -1
  9. package/build/legacy/IsRestoringProvider.cjs +0 -1
  10. package/build/legacy/IsRestoringProvider.cjs.map +1 -1
  11. package/build/legacy/IsRestoringProvider.d.cts +0 -1
  12. package/build/legacy/IsRestoringProvider.d.cts.map +1 -1
  13. package/build/legacy/IsRestoringProvider.d.ts +0 -1
  14. package/build/legacy/IsRestoringProvider.d.ts.map +1 -1
  15. package/build/legacy/IsRestoringProvider.js +0 -1
  16. package/build/legacy/IsRestoringProvider.js.map +1 -1
  17. package/build/legacy/QueryClientProvider.cjs +3 -4
  18. package/build/legacy/QueryClientProvider.cjs.map +1 -1
  19. package/build/legacy/QueryClientProvider.d.cts +3 -4
  20. package/build/legacy/QueryClientProvider.d.cts.map +1 -1
  21. package/build/legacy/QueryClientProvider.d.ts +3 -4
  22. package/build/legacy/QueryClientProvider.d.ts.map +1 -1
  23. package/build/legacy/QueryClientProvider.js +3 -4
  24. package/build/legacy/QueryClientProvider.js.map +1 -1
  25. package/build/legacy/QueryErrorResetBoundary.cjs +5 -5
  26. package/build/legacy/QueryErrorResetBoundary.cjs.map +1 -1
  27. package/build/legacy/QueryErrorResetBoundary.d.cts +23 -5
  28. package/build/legacy/QueryErrorResetBoundary.d.cts.map +1 -1
  29. package/build/legacy/QueryErrorResetBoundary.d.ts +23 -5
  30. package/build/legacy/QueryErrorResetBoundary.d.ts.map +1 -1
  31. package/build/legacy/QueryErrorResetBoundary.js +5 -5
  32. package/build/legacy/QueryErrorResetBoundary.js.map +1 -1
  33. package/build/legacy/errorBoundaryUtils.cjs +21 -0
  34. package/build/legacy/errorBoundaryUtils.cjs.map +1 -1
  35. package/build/legacy/errorBoundaryUtils.d.cts +21 -0
  36. package/build/legacy/errorBoundaryUtils.d.cts.map +1 -1
  37. package/build/legacy/errorBoundaryUtils.d.ts +21 -0
  38. package/build/legacy/errorBoundaryUtils.d.ts.map +1 -1
  39. package/build/legacy/errorBoundaryUtils.js +21 -0
  40. package/build/legacy/errorBoundaryUtils.js.map +1 -1
  41. package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
  42. package/build/legacy/infiniteQueryOptions.d.cts +5 -16
  43. package/build/legacy/infiniteQueryOptions.d.cts.map +1 -1
  44. package/build/legacy/infiniteQueryOptions.d.ts +5 -16
  45. package/build/legacy/infiniteQueryOptions.d.ts.map +1 -1
  46. package/build/legacy/infiniteQueryOptions.js.map +1 -1
  47. package/build/legacy/mutationOptions.cjs.map +1 -1
  48. package/build/legacy/mutationOptions.d.cts +2 -6
  49. package/build/legacy/mutationOptions.d.cts.map +1 -1
  50. package/build/legacy/mutationOptions.d.ts +2 -6
  51. package/build/legacy/mutationOptions.d.ts.map +1 -1
  52. package/build/legacy/mutationOptions.js.map +1 -1
  53. package/build/legacy/queryOptions.cjs.map +1 -1
  54. package/build/legacy/queryOptions.d.cts +6 -16
  55. package/build/legacy/queryOptions.d.cts.map +1 -1
  56. package/build/legacy/queryOptions.d.ts +6 -16
  57. package/build/legacy/queryOptions.d.ts.map +1 -1
  58. package/build/legacy/queryOptions.js.map +1 -1
  59. package/build/legacy/suspense.cjs +27 -0
  60. package/build/legacy/suspense.cjs.map +1 -1
  61. package/build/legacy/suspense.d.cts +27 -0
  62. package/build/legacy/suspense.d.cts.map +1 -1
  63. package/build/legacy/suspense.d.ts +27 -0
  64. package/build/legacy/suspense.d.ts.map +1 -1
  65. package/build/legacy/suspense.js +27 -0
  66. package/build/legacy/suspense.js.map +1 -1
  67. package/build/legacy/types.cjs.map +1 -1
  68. package/build/legacy/types.d.cts +2 -22
  69. package/build/legacy/types.d.cts.map +1 -1
  70. package/build/legacy/types.d.ts +2 -22
  71. package/build/legacy/types.d.ts.map +1 -1
  72. package/build/legacy/types.js.map +1 -1
  73. package/build/legacy/useBaseQuery.cjs +13 -0
  74. package/build/legacy/useBaseQuery.cjs.map +1 -1
  75. package/build/legacy/useBaseQuery.d.cts +13 -0
  76. package/build/legacy/useBaseQuery.d.cts.map +1 -1
  77. package/build/legacy/useBaseQuery.d.ts +13 -0
  78. package/build/legacy/useBaseQuery.d.ts.map +1 -1
  79. package/build/legacy/useBaseQuery.js +13 -0
  80. package/build/legacy/useBaseQuery.js.map +1 -1
  81. package/build/legacy/useInfiniteQuery.cjs.map +1 -1
  82. package/build/legacy/useInfiniteQuery.d.cts +12 -21
  83. package/build/legacy/useInfiniteQuery.d.cts.map +1 -1
  84. package/build/legacy/useInfiniteQuery.d.ts +12 -21
  85. package/build/legacy/useInfiniteQuery.d.ts.map +1 -1
  86. package/build/legacy/useInfiniteQuery.js.map +1 -1
  87. package/build/legacy/useIsFetching.cjs +0 -3
  88. package/build/legacy/useIsFetching.cjs.map +1 -1
  89. package/build/legacy/useIsFetching.d.cts +0 -3
  90. package/build/legacy/useIsFetching.d.cts.map +1 -1
  91. package/build/legacy/useIsFetching.d.ts +0 -3
  92. package/build/legacy/useIsFetching.d.ts.map +1 -1
  93. package/build/legacy/useIsFetching.js +0 -3
  94. package/build/legacy/useIsFetching.js.map +1 -1
  95. package/build/legacy/useMutation.cjs +4 -8
  96. package/build/legacy/useMutation.cjs.map +1 -1
  97. package/build/legacy/useMutation.d.cts +4 -8
  98. package/build/legacy/useMutation.d.cts.map +1 -1
  99. package/build/legacy/useMutation.d.ts +4 -8
  100. package/build/legacy/useMutation.d.ts.map +1 -1
  101. package/build/legacy/useMutation.js +4 -8
  102. package/build/legacy/useMutation.js.map +1 -1
  103. package/build/legacy/useMutationState.cjs +7 -6
  104. package/build/legacy/useMutationState.cjs.map +1 -1
  105. package/build/legacy/useMutationState.d.cts +0 -6
  106. package/build/legacy/useMutationState.d.cts.map +1 -1
  107. package/build/legacy/useMutationState.d.ts +0 -6
  108. package/build/legacy/useMutationState.d.ts.map +1 -1
  109. package/build/legacy/useMutationState.js +7 -6
  110. package/build/legacy/useMutationState.js.map +1 -1
  111. package/build/legacy/usePrefetchInfiniteQuery.cjs +0 -3
  112. package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
  113. package/build/legacy/usePrefetchInfiniteQuery.d.cts +0 -3
  114. package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -1
  115. package/build/legacy/usePrefetchInfiniteQuery.d.ts +0 -3
  116. package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -1
  117. package/build/legacy/usePrefetchInfiniteQuery.js +0 -3
  118. package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
  119. package/build/legacy/usePrefetchQuery.cjs +0 -3
  120. package/build/legacy/usePrefetchQuery.cjs.map +1 -1
  121. package/build/legacy/usePrefetchQuery.d.cts +0 -3
  122. package/build/legacy/usePrefetchQuery.d.cts.map +1 -1
  123. package/build/legacy/usePrefetchQuery.d.ts +0 -3
  124. package/build/legacy/usePrefetchQuery.d.ts.map +1 -1
  125. package/build/legacy/usePrefetchQuery.js +0 -3
  126. package/build/legacy/usePrefetchQuery.js.map +1 -1
  127. package/build/legacy/useQueries.cjs +7 -8
  128. package/build/legacy/useQueries.cjs.map +1 -1
  129. package/build/legacy/useQueries.d.cts +7 -11
  130. package/build/legacy/useQueries.d.cts.map +1 -1
  131. package/build/legacy/useQueries.d.ts +7 -11
  132. package/build/legacy/useQueries.d.ts.map +1 -1
  133. package/build/legacy/useQueries.js +7 -8
  134. package/build/legacy/useQueries.js.map +1 -1
  135. package/build/legacy/useQuery.cjs.map +1 -1
  136. package/build/legacy/useQuery.d.cts +8 -13
  137. package/build/legacy/useQuery.d.cts.map +1 -1
  138. package/build/legacy/useQuery.d.ts +8 -13
  139. package/build/legacy/useQuery.d.ts.map +1 -1
  140. package/build/legacy/useQuery.js.map +1 -1
  141. package/build/legacy/useSuspenseInfiniteQuery.cjs +6 -8
  142. package/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -1
  143. package/build/legacy/useSuspenseInfiniteQuery.d.cts +6 -8
  144. package/build/legacy/useSuspenseInfiniteQuery.d.cts.map +1 -1
  145. package/build/legacy/useSuspenseInfiniteQuery.d.ts +6 -8
  146. package/build/legacy/useSuspenseInfiniteQuery.d.ts.map +1 -1
  147. package/build/legacy/useSuspenseInfiniteQuery.js +6 -8
  148. package/build/legacy/useSuspenseInfiniteQuery.js.map +1 -1
  149. package/build/legacy/useSuspenseQueries.cjs.map +1 -1
  150. package/build/legacy/useSuspenseQueries.d.cts +0 -9
  151. package/build/legacy/useSuspenseQueries.d.cts.map +1 -1
  152. package/build/legacy/useSuspenseQueries.d.ts +0 -9
  153. package/build/legacy/useSuspenseQueries.d.ts.map +1 -1
  154. package/build/legacy/useSuspenseQueries.js.map +1 -1
  155. package/build/legacy/useSuspenseQuery.cjs +4 -6
  156. package/build/legacy/useSuspenseQuery.cjs.map +1 -1
  157. package/build/legacy/useSuspenseQuery.d.cts +4 -6
  158. package/build/legacy/useSuspenseQuery.d.cts.map +1 -1
  159. package/build/legacy/useSuspenseQuery.d.ts +4 -6
  160. package/build/legacy/useSuspenseQuery.d.ts.map +1 -1
  161. package/build/legacy/useSuspenseQuery.js +4 -6
  162. package/build/legacy/useSuspenseQuery.js.map +1 -1
  163. package/build/modern/HydrationBoundary.cjs +2 -3
  164. package/build/modern/HydrationBoundary.cjs.map +1 -1
  165. package/build/modern/HydrationBoundary.d.cts +2 -3
  166. package/build/modern/HydrationBoundary.d.cts.map +1 -1
  167. package/build/modern/HydrationBoundary.d.ts +2 -3
  168. package/build/modern/HydrationBoundary.d.ts.map +1 -1
  169. package/build/modern/HydrationBoundary.js +2 -3
  170. package/build/modern/HydrationBoundary.js.map +1 -1
  171. package/build/modern/IsRestoringProvider.cjs +0 -1
  172. package/build/modern/IsRestoringProvider.cjs.map +1 -1
  173. package/build/modern/IsRestoringProvider.d.cts +0 -1
  174. package/build/modern/IsRestoringProvider.d.cts.map +1 -1
  175. package/build/modern/IsRestoringProvider.d.ts +0 -1
  176. package/build/modern/IsRestoringProvider.d.ts.map +1 -1
  177. package/build/modern/IsRestoringProvider.js +0 -1
  178. package/build/modern/IsRestoringProvider.js.map +1 -1
  179. package/build/modern/QueryClientProvider.cjs +3 -4
  180. package/build/modern/QueryClientProvider.cjs.map +1 -1
  181. package/build/modern/QueryClientProvider.d.cts +3 -4
  182. package/build/modern/QueryClientProvider.d.cts.map +1 -1
  183. package/build/modern/QueryClientProvider.d.ts +3 -4
  184. package/build/modern/QueryClientProvider.d.ts.map +1 -1
  185. package/build/modern/QueryClientProvider.js +3 -4
  186. package/build/modern/QueryClientProvider.js.map +1 -1
  187. package/build/modern/QueryErrorResetBoundary.cjs +5 -5
  188. package/build/modern/QueryErrorResetBoundary.cjs.map +1 -1
  189. package/build/modern/QueryErrorResetBoundary.d.cts +23 -5
  190. package/build/modern/QueryErrorResetBoundary.d.cts.map +1 -1
  191. package/build/modern/QueryErrorResetBoundary.d.ts +23 -5
  192. package/build/modern/QueryErrorResetBoundary.d.ts.map +1 -1
  193. package/build/modern/QueryErrorResetBoundary.js +5 -5
  194. package/build/modern/QueryErrorResetBoundary.js.map +1 -1
  195. package/build/modern/errorBoundaryUtils.cjs +21 -0
  196. package/build/modern/errorBoundaryUtils.cjs.map +1 -1
  197. package/build/modern/errorBoundaryUtils.d.cts +21 -0
  198. package/build/modern/errorBoundaryUtils.d.cts.map +1 -1
  199. package/build/modern/errorBoundaryUtils.d.ts +21 -0
  200. package/build/modern/errorBoundaryUtils.d.ts.map +1 -1
  201. package/build/modern/errorBoundaryUtils.js +21 -0
  202. package/build/modern/errorBoundaryUtils.js.map +1 -1
  203. package/build/modern/infiniteQueryOptions.cjs.map +1 -1
  204. package/build/modern/infiniteQueryOptions.d.cts +5 -16
  205. package/build/modern/infiniteQueryOptions.d.cts.map +1 -1
  206. package/build/modern/infiniteQueryOptions.d.ts +5 -16
  207. package/build/modern/infiniteQueryOptions.d.ts.map +1 -1
  208. package/build/modern/infiniteQueryOptions.js.map +1 -1
  209. package/build/modern/mutationOptions.cjs.map +1 -1
  210. package/build/modern/mutationOptions.d.cts +2 -6
  211. package/build/modern/mutationOptions.d.cts.map +1 -1
  212. package/build/modern/mutationOptions.d.ts +2 -6
  213. package/build/modern/mutationOptions.d.ts.map +1 -1
  214. package/build/modern/mutationOptions.js.map +1 -1
  215. package/build/modern/queryOptions.cjs.map +1 -1
  216. package/build/modern/queryOptions.d.cts +6 -16
  217. package/build/modern/queryOptions.d.cts.map +1 -1
  218. package/build/modern/queryOptions.d.ts +6 -16
  219. package/build/modern/queryOptions.d.ts.map +1 -1
  220. package/build/modern/queryOptions.js.map +1 -1
  221. package/build/modern/suspense.cjs +27 -0
  222. package/build/modern/suspense.cjs.map +1 -1
  223. package/build/modern/suspense.d.cts +27 -0
  224. package/build/modern/suspense.d.cts.map +1 -1
  225. package/build/modern/suspense.d.ts +27 -0
  226. package/build/modern/suspense.d.ts.map +1 -1
  227. package/build/modern/suspense.js +27 -0
  228. package/build/modern/suspense.js.map +1 -1
  229. package/build/modern/types.cjs.map +1 -1
  230. package/build/modern/types.d.cts +2 -22
  231. package/build/modern/types.d.cts.map +1 -1
  232. package/build/modern/types.d.ts +2 -22
  233. package/build/modern/types.d.ts.map +1 -1
  234. package/build/modern/types.js.map +1 -1
  235. package/build/modern/useBaseQuery.cjs +13 -0
  236. package/build/modern/useBaseQuery.cjs.map +1 -1
  237. package/build/modern/useBaseQuery.d.cts +13 -0
  238. package/build/modern/useBaseQuery.d.cts.map +1 -1
  239. package/build/modern/useBaseQuery.d.ts +13 -0
  240. package/build/modern/useBaseQuery.d.ts.map +1 -1
  241. package/build/modern/useBaseQuery.js +13 -0
  242. package/build/modern/useBaseQuery.js.map +1 -1
  243. package/build/modern/useInfiniteQuery.cjs.map +1 -1
  244. package/build/modern/useInfiniteQuery.d.cts +12 -21
  245. package/build/modern/useInfiniteQuery.d.cts.map +1 -1
  246. package/build/modern/useInfiniteQuery.d.ts +12 -21
  247. package/build/modern/useInfiniteQuery.d.ts.map +1 -1
  248. package/build/modern/useInfiniteQuery.js.map +1 -1
  249. package/build/modern/useIsFetching.cjs +0 -3
  250. package/build/modern/useIsFetching.cjs.map +1 -1
  251. package/build/modern/useIsFetching.d.cts +0 -3
  252. package/build/modern/useIsFetching.d.cts.map +1 -1
  253. package/build/modern/useIsFetching.d.ts +0 -3
  254. package/build/modern/useIsFetching.d.ts.map +1 -1
  255. package/build/modern/useIsFetching.js +0 -3
  256. package/build/modern/useIsFetching.js.map +1 -1
  257. package/build/modern/useMutation.cjs +4 -8
  258. package/build/modern/useMutation.cjs.map +1 -1
  259. package/build/modern/useMutation.d.cts +4 -8
  260. package/build/modern/useMutation.d.cts.map +1 -1
  261. package/build/modern/useMutation.d.ts +4 -8
  262. package/build/modern/useMutation.d.ts.map +1 -1
  263. package/build/modern/useMutation.js +4 -8
  264. package/build/modern/useMutation.js.map +1 -1
  265. package/build/modern/useMutationState.cjs +7 -6
  266. package/build/modern/useMutationState.cjs.map +1 -1
  267. package/build/modern/useMutationState.d.cts +0 -6
  268. package/build/modern/useMutationState.d.cts.map +1 -1
  269. package/build/modern/useMutationState.d.ts +0 -6
  270. package/build/modern/useMutationState.d.ts.map +1 -1
  271. package/build/modern/useMutationState.js +7 -6
  272. package/build/modern/useMutationState.js.map +1 -1
  273. package/build/modern/usePrefetchInfiniteQuery.cjs +0 -3
  274. package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
  275. package/build/modern/usePrefetchInfiniteQuery.d.cts +0 -3
  276. package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -1
  277. package/build/modern/usePrefetchInfiniteQuery.d.ts +0 -3
  278. package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -1
  279. package/build/modern/usePrefetchInfiniteQuery.js +0 -3
  280. package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
  281. package/build/modern/usePrefetchQuery.cjs +0 -3
  282. package/build/modern/usePrefetchQuery.cjs.map +1 -1
  283. package/build/modern/usePrefetchQuery.d.cts +0 -3
  284. package/build/modern/usePrefetchQuery.d.cts.map +1 -1
  285. package/build/modern/usePrefetchQuery.d.ts +0 -3
  286. package/build/modern/usePrefetchQuery.d.ts.map +1 -1
  287. package/build/modern/usePrefetchQuery.js +0 -3
  288. package/build/modern/usePrefetchQuery.js.map +1 -1
  289. package/build/modern/useQueries.cjs +7 -8
  290. package/build/modern/useQueries.cjs.map +1 -1
  291. package/build/modern/useQueries.d.cts +7 -11
  292. package/build/modern/useQueries.d.cts.map +1 -1
  293. package/build/modern/useQueries.d.ts +7 -11
  294. package/build/modern/useQueries.d.ts.map +1 -1
  295. package/build/modern/useQueries.js +7 -8
  296. package/build/modern/useQueries.js.map +1 -1
  297. package/build/modern/useQuery.cjs.map +1 -1
  298. package/build/modern/useQuery.d.cts +8 -13
  299. package/build/modern/useQuery.d.cts.map +1 -1
  300. package/build/modern/useQuery.d.ts +8 -13
  301. package/build/modern/useQuery.d.ts.map +1 -1
  302. package/build/modern/useQuery.js.map +1 -1
  303. package/build/modern/useSuspenseInfiniteQuery.cjs +6 -8
  304. package/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -1
  305. package/build/modern/useSuspenseInfiniteQuery.d.cts +6 -8
  306. package/build/modern/useSuspenseInfiniteQuery.d.cts.map +1 -1
  307. package/build/modern/useSuspenseInfiniteQuery.d.ts +6 -8
  308. package/build/modern/useSuspenseInfiniteQuery.d.ts.map +1 -1
  309. package/build/modern/useSuspenseInfiniteQuery.js +6 -8
  310. package/build/modern/useSuspenseInfiniteQuery.js.map +1 -1
  311. package/build/modern/useSuspenseQueries.cjs.map +1 -1
  312. package/build/modern/useSuspenseQueries.d.cts +0 -9
  313. package/build/modern/useSuspenseQueries.d.cts.map +1 -1
  314. package/build/modern/useSuspenseQueries.d.ts +0 -9
  315. package/build/modern/useSuspenseQueries.d.ts.map +1 -1
  316. package/build/modern/useSuspenseQueries.js.map +1 -1
  317. package/build/modern/useSuspenseQuery.cjs +4 -6
  318. package/build/modern/useSuspenseQuery.cjs.map +1 -1
  319. package/build/modern/useSuspenseQuery.d.cts +4 -6
  320. package/build/modern/useSuspenseQuery.d.cts.map +1 -1
  321. package/build/modern/useSuspenseQuery.d.ts +4 -6
  322. package/build/modern/useSuspenseQuery.d.ts.map +1 -1
  323. package/build/modern/useSuspenseQuery.js +4 -6
  324. package/build/modern/useSuspenseQuery.js.map +1 -1
  325. package/package.json +6 -6
  326. package/src/HydrationBoundary.tsx +4 -5
  327. package/src/IsRestoringProvider.ts +0 -1
  328. package/src/QueryClientProvider.tsx +3 -4
  329. package/src/QueryErrorResetBoundary.tsx +30 -6
  330. package/src/errorBoundaryUtils.ts +21 -0
  331. package/src/infiniteQueryOptions.ts +5 -16
  332. package/src/mutationOptions.ts +2 -6
  333. package/src/queryOptions.ts +8 -17
  334. package/src/suspense.ts +29 -1
  335. package/src/types.ts +2 -22
  336. package/src/useBaseQuery.ts +13 -0
  337. package/src/useInfiniteQuery.ts +12 -21
  338. package/src/useIsFetching.ts +0 -3
  339. package/src/useMutation.ts +4 -8
  340. package/src/useMutationState.ts +7 -6
  341. package/src/usePrefetchInfiniteQuery.tsx +0 -3
  342. package/src/usePrefetchQuery.tsx +0 -3
  343. package/src/useQueries.ts +7 -11
  344. package/src/useQuery.ts +8 -13
  345. package/src/useSuspenseInfiniteQuery.ts +6 -8
  346. package/src/useSuspenseQueries.ts +0 -9
  347. package/src/useSuspenseQuery.ts +4 -6
@@ -3,7 +3,9 @@ import * as React from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/QueryErrorResetBoundary.tsx
5
5
  /**
6
- * Resets any query errors within the boundary, so queries know they can try again.
6
+ * Creates the value shared through the boundary's context, which tracks whether a reset was
7
+ * requested.
8
+ * @returns The `clearReset`, `isReset`, and `reset` functions of the boundary.
7
9
  */
8
10
  function createValue() {
9
11
  let isReset = false;
@@ -22,6 +24,7 @@ function createValue() {
22
24
  },
23
25
  /**
24
26
  * Returns whether the boundary has been reset and not yet cleared.
27
+ * @returns `true` if the boundary has been reset and not yet cleared.
25
28
  */
26
29
  isReset: () => {
27
30
  return isReset;
@@ -32,9 +35,7 @@ const QueryErrorResetBoundaryContext = React.createContext(createValue());
32
35
  /**
33
36
  * This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary
34
37
  * defined it will reset them globally.
35
- *
36
38
  * @returns The boundary's {@link QueryErrorResetBoundaryValue}.
37
- *
38
39
  * @example
39
40
  * ```tsx
40
41
  * import { ErrorBoundary } from 'react-error-boundary'
@@ -64,10 +65,9 @@ const useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundar
64
65
  * When using `suspense` or `throwOnError` in your queries, you need a way to let queries know that you want to
65
66
  * try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can
66
67
  * reset any query errors within the boundaries of the component.
67
- *
68
+ * @param props - The `children` to render.
68
69
  * @returns The `children`, rendered as-is, or called with the boundary's {@link QueryErrorResetBoundaryValue}
69
70
  * if `children` is a function.
70
- *
71
71
  * @example
72
72
  * ```tsx
73
73
  * import { ErrorBoundary } from 'react-error-boundary'
@@ -1 +1 @@
1
- {"version":3,"file":"QueryErrorResetBoundary.js","names":[],"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\n/**\n * Resets any query errors within the boundary, so queries know they can try again.\n */\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n /**\n * Clears the reset state, so queries know not to try again until the boundary is reset again.\n */\n clearReset: () => {\n isReset = false\n },\n /**\n * Resets any query errors within the boundary, so queries know they can try again.\n */\n reset: () => {\n isReset = true\n },\n /**\n * Returns whether the boundary has been reset and not yet cleared.\n */\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\n/**\n * This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary\n * defined it will reset them globally.\n *\n * @returns The boundary's {@link QueryErrorResetBoundaryValue}.\n *\n * @example\n * ```tsx\n * import { ErrorBoundary } from 'react-error-boundary'\n * import { useQueryErrorResetBoundary } from '@tanstack/react-query'\n *\n * function App({ children }: { children: React.ReactNode }) {\n * const { reset } = useQueryErrorResetBoundary()\n *\n * return (\n * <ErrorBoundary\n * onReset={reset}\n * fallbackRender={({ resetErrorBoundary }) => (\n * <div>\n * There was an error!\n * <button onClick={() => resetErrorBoundary()}>Try again</button>\n * </div>\n * )}\n * >\n * {children}\n * </ErrorBoundary>\n * )\n * }\n * ```\n */\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\n/**\n * A render-prop function usable as `children` on `QueryErrorResetBoundary`.\n *\n * @param value - The boundary's {@link QueryErrorResetBoundaryValue}.\n * @returns The children to render.\n */\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\n/**\n * The props accepted by `QueryErrorResetBoundary`.\n */\nexport interface QueryErrorResetBoundaryProps {\n /**\n * Either a plain node, or a function that receives the boundary's {@link QueryErrorResetBoundaryValue} and\n * returns a node.\n */\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\n/**\n * When using `suspense` or `throwOnError` in your queries, you need a way to let queries know that you want to\n * try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can\n * reset any query errors within the boundaries of the component.\n *\n * @returns The `children`, rendered as-is, or called with the boundary's {@link QueryErrorResetBoundaryValue}\n * if `children` is a function.\n *\n * @example\n * ```tsx\n * import { ErrorBoundary } from 'react-error-boundary'\n * import { QueryErrorResetBoundary } from '@tanstack/react-query'\n *\n * function App() {\n * return (\n * <QueryErrorResetBoundary>\n * {({ reset }) => (\n * <ErrorBoundary\n * onReset={reset}\n * fallbackRender={({ resetErrorBoundary }) => (\n * <div>\n * There was an error!\n * <button onClick={() => resetErrorBoundary()}>Try again</button>\n * </div>\n * )}\n * >\n * <Page />\n * </ErrorBoundary>\n * )}\n * </QueryErrorResetBoundary>\n * )\n * }\n * ```\n */\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;;;;;AAiBA,SAAS,cAA4C;CACnD,IAAI,UAAU;CACd,OAAO;;;;EAIL,kBAAkB;GAChB,UAAU;EACZ;;;;EAIA,aAAa;GACX,UAAU;EACZ;;;;EAIA,eAAe;GACb,OAAO;EACT;CACF;AACF;AAEA,MAAM,iCAAiC,MAAM,cAAc,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCxE,MAAa,mCACX,MAAM,WAAW,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DjD,MAAa,2BAA2B,EACtC,eACkC;CAClC,MAAM,CAAC,SAAS,MAAM,eAAe,YAAY,CAAC;CAClD,OACE,oBAAC,+BAA+B,UAAhC;EAAgD;EAC7C,UAAA,OAAO,aAAa,aAAa,SAAS,KAAK,IAAI;CACb,CAAA;AAE7C"}
1
+ {"version":3,"file":"QueryErrorResetBoundary.js","names":[],"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\n\n/**\n * Resets any query errors within the boundary, so queries know they can try again.\n */\nexport type QueryErrorResetFunction = () => void\n\n/**\n * Returns whether the boundary has been reset and not yet cleared.\n */\nexport type QueryErrorIsResetFunction = () => boolean\n\n/**\n * Clears the reset state, so queries know not to try again until the boundary is reset again.\n */\nexport type QueryErrorClearResetFunction = () => void\n\n/**\n * The value a `QueryErrorResetBoundary` shares through context, used to reset query errors within\n * it and to check whether a reset was requested.\n */\nexport interface QueryErrorResetBoundaryValue {\n /**\n * Clears the reset state, so queries know not to try again until the boundary is reset again.\n */\n clearReset: QueryErrorClearResetFunction\n /**\n * Returns whether the boundary has been reset and not yet cleared.\n */\n isReset: QueryErrorIsResetFunction\n /**\n * Resets any query errors within the boundary, so queries know they can try again.\n */\n reset: QueryErrorResetFunction\n}\n\n/**\n * Creates the value shared through the boundary's context, which tracks whether a reset was\n * requested.\n * @returns The `clearReset`, `isReset`, and `reset` functions of the boundary.\n */\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n /**\n * Clears the reset state, so queries know not to try again until the boundary is reset again.\n */\n clearReset: () => {\n isReset = false\n },\n /**\n * Resets any query errors within the boundary, so queries know they can try again.\n */\n reset: () => {\n isReset = true\n },\n /**\n * Returns whether the boundary has been reset and not yet cleared.\n * @returns `true` if the boundary has been reset and not yet cleared.\n */\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\n/**\n * This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary\n * defined it will reset them globally.\n * @returns The boundary's {@link QueryErrorResetBoundaryValue}.\n * @example\n * ```tsx\n * import { ErrorBoundary } from 'react-error-boundary'\n * import { useQueryErrorResetBoundary } from '@tanstack/react-query'\n *\n * function App({ children }: { children: React.ReactNode }) {\n * const { reset } = useQueryErrorResetBoundary()\n *\n * return (\n * <ErrorBoundary\n * onReset={reset}\n * fallbackRender={({ resetErrorBoundary }) => (\n * <div>\n * There was an error!\n * <button onClick={() => resetErrorBoundary()}>Try again</button>\n * </div>\n * )}\n * >\n * {children}\n * </ErrorBoundary>\n * )\n * }\n * ```\n */\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\n/**\n * A render-prop function usable as `children` on `QueryErrorResetBoundary`.\n * @param value - The boundary's {@link QueryErrorResetBoundaryValue}.\n * @returns The children to render.\n */\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\n/**\n * The props accepted by `QueryErrorResetBoundary`.\n */\nexport interface QueryErrorResetBoundaryProps {\n /**\n * Either a plain node, or a function that receives the boundary's {@link QueryErrorResetBoundaryValue} and\n * returns a node.\n */\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\n/**\n * When using `suspense` or `throwOnError` in your queries, you need a way to let queries know that you want to\n * try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can\n * reset any query errors within the boundaries of the component.\n * @param props - The `children` to render.\n * @returns The `children`, rendered as-is, or called with the boundary's {@link QueryErrorResetBoundaryValue}\n * if `children` is a function.\n * @example\n * ```tsx\n * import { ErrorBoundary } from 'react-error-boundary'\n * import { QueryErrorResetBoundary } from '@tanstack/react-query'\n *\n * function App() {\n * return (\n * <QueryErrorResetBoundary>\n * {({ reset }) => (\n * <ErrorBoundary\n * onReset={reset}\n * fallbackRender={({ resetErrorBoundary }) => (\n * <div>\n * There was an error!\n * <button onClick={() => resetErrorBoundary()}>Try again</button>\n * </div>\n * )}\n * >\n * <Page />\n * </ErrorBoundary>\n * )}\n * </QueryErrorResetBoundary>\n * )\n * }\n * ```\n */\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;AA4CA,SAAS,cAA4C;CACnD,IAAI,UAAU;CACd,OAAO;;;;EAIL,kBAAkB;GAChB,UAAU;EACZ;;;;EAIA,aAAa;GACX,UAAU;EACZ;;;;;EAKA,eAAe;GACb,OAAO;EACT;CACF;AACF;AAEA,MAAM,iCAAiC,MAAM,cAAc,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCxE,MAAa,mCACX,MAAM,WAAW,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDjD,MAAa,2BAA2B,EACtC,eACkC;CAClC,MAAM,CAAC,SAAS,MAAM,eAAe,YAAY,CAAC;CAClD,OACE,oBAAC,+BAA+B,UAAhC;EAAgD;EAC7C,UAAA,OAAO,aAAa,aAAa,SAAS,KAAK,IAAI;CACb,CAAA;AAE7C"}
@@ -5,17 +5,38 @@ let react = require("react");
5
5
  react = require_rolldown_runtime.__toESM(react, 1);
6
6
  let _tanstack_query_core = require("@tanstack/query-core");
7
7
  //#region src/errorBoundaryUtils.ts
8
+ /**
9
+ * Turns off `retryOnMount` for a query that throws its errors (with `suspense` or `throwOnError`),
10
+ * unless the error boundary has been reset, so a remount doesn't retry the failed query before the
11
+ * user resets the boundary. Mutates the options.
12
+ * @param options - The defaulted query options to adjust.
13
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
14
+ * @param query - The query, used to evaluate a `throwOnError` function against its error.
15
+ */
8
16
  const ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
9
17
  const throwOnError = (query === null || query === void 0 ? void 0 : query.state.error) && typeof options.throwOnError === "function" ? (0, _tanstack_query_core.shouldThrowError)(options.throwOnError, [query.state.error, query]) : options.throwOnError;
10
18
  if (options.suspense || throwOnError) {
11
19
  if (!errorResetBoundary.isReset()) options.retryOnMount = false;
12
20
  }
13
21
  };
22
+ /**
23
+ * Clears the reset state of the error boundary after the component mounts, so later errors are
24
+ * thrown to the boundary again.
25
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
26
+ */
14
27
  const useClearResetErrorBoundary = (errorResetBoundary) => {
15
28
  react.useEffect(() => {
16
29
  errorResetBoundary.clearReset();
17
30
  }, [errorResetBoundary]);
18
31
  };
32
+ /**
33
+ * Checks whether the query error should be thrown to the nearest error boundary: the query errored
34
+ * and isn't fetching, the boundary hasn't been reset, and either `suspense` is enabled with no data
35
+ * or `throwOnError` says so.
36
+ * @param params - The observer `result`, the `errorResetBoundary`, the `throwOnError` option, the
37
+ * `query`, and the `suspense` option.
38
+ * @returns `true` if the error should be thrown.
39
+ */
19
40
  const getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
20
41
  return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || (0, _tanstack_query_core.shouldThrowError)(throwOnError, [result.error, query]));
21
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"errorBoundaryUtils.cjs","names":["shouldThrowError"],"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (options.suspense || throwOnError) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;;;;AAYA,MAAa,mCAOX,SAOA,oBACA,UACG;CACH,MAAM,gBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IACJ,MAAO,MAAM,UAAS,OAAO,QAAQ,iBAAiB,cAAA,GAClDA,qBAAAA,iBAAAA,CAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;CAEd,IAAI,QAAQ,YAAY,cAElB;MAAA,CAAC,mBAAmB,QAAQ,GAC9B,QAAQ,eAAe;CAAA;AAG7B;AAEA,MAAa,8BACX,uBACG;CACH,MAAM,gBAAgB;EACpB,mBAAmB,WAAW;CAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;AAEA,MAAa,eAMX,EACA,QACA,oBACA,cACA,OACA,eAOI;CACJ,OACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,KAAA,MAAA,GAC5BA,qBAAAA,iBAAAA,CAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D"}
1
+ {"version":3,"file":"errorBoundaryUtils.cjs","names":["shouldThrowError"],"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\n/**\n * Turns off `retryOnMount` for a query that throws its errors (with `suspense` or `throwOnError`),\n * unless the error boundary has been reset, so a remount doesn't retry the failed query before the\n * user resets the boundary. Mutates the options.\n * @param options - The defaulted query options to adjust.\n * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.\n * @param query - The query, used to evaluate a `throwOnError` function against its error.\n */\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (options.suspense || throwOnError) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\n/**\n * Clears the reset state of the error boundary after the component mounts, so later errors are\n * thrown to the boundary again.\n * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.\n */\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\n/**\n * Checks whether the query error should be thrown to the nearest error boundary: the query errored\n * and isn't fetching, the boundary hasn't been reset, and either `suspense` is enabled with no data\n * or `throwOnError` says so.\n * @param params - The observer `result`, the `errorResetBoundary`, the `throwOnError` option, the\n * `query`, and the `suspense` option.\n * @returns `true` if the error should be thrown.\n */\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAa,mCAOX,SAOA,oBACA,UACG;CACH,MAAM,gBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IACJ,MAAO,MAAM,UAAS,OAAO,QAAQ,iBAAiB,cAAA,GAClDA,qBAAAA,iBAAAA,CAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;CAEd,IAAI,QAAQ,YAAY,cAElB;MAAA,CAAC,mBAAmB,QAAQ,GAC9B,QAAQ,eAAe;CAAA;AAG7B;;;;;;AAOA,MAAa,8BACX,uBACG;CACH,MAAM,gBAAgB;EACpB,mBAAmB,WAAW;CAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;;;;;;;;;AAUA,MAAa,eAMX,EACA,QACA,oBACA,cACA,OACA,eAOI;CACJ,OACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,KAAA,MAAA,GAC5BA,qBAAAA,iBAAAA,CAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D"}
@@ -1,8 +1,29 @@
1
1
  import { QueryErrorResetBoundaryValue } from "./QueryErrorResetBoundary.cjs";
2
2
  import { DefaultedQueryObserverOptions, Query, QueryKey, QueryObserverResult, ThrowOnError } from "@tanstack/query-core";
3
3
  //#region src/errorBoundaryUtils.d.ts
4
+ /**
5
+ * Turns off `retryOnMount` for a query that throws its errors (with `suspense` or `throwOnError`),
6
+ * unless the error boundary has been reset, so a remount doesn't retry the failed query before the
7
+ * user resets the boundary. Mutates the options.
8
+ * @param options - The defaulted query options to adjust.
9
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
10
+ * @param query - The query, used to evaluate a `throwOnError` function against its error.
11
+ */
4
12
  export declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue, query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined) => void;
13
+ /**
14
+ * Clears the reset state of the error boundary after the component mounts, so later errors are
15
+ * thrown to the boundary again.
16
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
17
+ */
5
18
  export declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void;
19
+ /**
20
+ * Checks whether the query error should be thrown to the nearest error boundary: the query errored
21
+ * and isn't fetching, the boundary hasn't been reset, and either `suspense` is enabled with no data
22
+ * or `throwOnError` says so.
23
+ * @param params - The observer `result`, the `errorResetBoundary`, the `throwOnError` option, the
24
+ * `query`, and the `suspense` option.
25
+ * @returns `true` if the error should be thrown.
26
+ */
6
27
  export declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, suspense }: {
7
28
  result: QueryObserverResult<TData, TError>;
8
29
  errorResetBoundary: QueryErrorResetBoundaryValue;
@@ -1 +1 @@
1
- {"version":3,"file":"errorBoundaryUtils.d.cts","names":[],"sources":["../../src/errorBoundaryUtils.ts"],"mappings":";;;qBAYa,kCACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,8BACP,cACA,QACA,OACA,YACA,YAEF,oBAAoB,8BACpB,OAAO,MAAM,cAAc,QAAQ,YAAY;qBAepC,6BACX,oBAAoB;qBAOT,cACX,OACA,QACA,cACA,YACA,kBAAkB,YAClB,QAAA,oBAAA,cAAA,OAAA;EAOA,QAAQ,oBAAoB,OAAO;EACnC,oBAAoB;EACpB,cAAc,aAAa,cAAc,QAAQ,YAAY;EAC7D,OAAO,MAAM,cAAc,QAAQ,YAAY;EAC/C"}
1
+ {"version":3,"file":"errorBoundaryUtils.d.cts","names":[],"sources":["../../src/errorBoundaryUtils.ts"],"mappings":";;;;;;;;;;;qBAoBa,kCACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,8BACP,cACA,QACA,OACA,YACA,YAEF,oBAAoB,8BACpB,OAAO,MAAM,cAAc,QAAQ,YAAY;;;;;;qBAoBpC,6BACX,oBAAoB;;;;;;;;;qBAeT,cACX,OACA,QACA,cACA,YACA,kBAAkB,YAClB,QAAA,oBAAA,cAAA,OAAA;EAOA,QAAQ,oBAAoB,OAAO;EACnC,oBAAoB;EACpB,cAAc,aAAa,cAAc,QAAQ,YAAY;EAC7D,OAAO,MAAM,cAAc,QAAQ,YAAY;EAC/C"}
@@ -1,8 +1,29 @@
1
1
  import { QueryErrorResetBoundaryValue } from "./QueryErrorResetBoundary.js";
2
2
  import { DefaultedQueryObserverOptions, Query, QueryKey, QueryObserverResult, ThrowOnError } from "@tanstack/query-core";
3
3
  //#region src/errorBoundaryUtils.d.ts
4
+ /**
5
+ * Turns off `retryOnMount` for a query that throws its errors (with `suspense` or `throwOnError`),
6
+ * unless the error boundary has been reset, so a remount doesn't retry the failed query before the
7
+ * user resets the boundary. Mutates the options.
8
+ * @param options - The defaulted query options to adjust.
9
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
10
+ * @param query - The query, used to evaluate a `throwOnError` function against its error.
11
+ */
4
12
  export declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue, query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined) => void;
13
+ /**
14
+ * Clears the reset state of the error boundary after the component mounts, so later errors are
15
+ * thrown to the boundary again.
16
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
17
+ */
5
18
  export declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void;
19
+ /**
20
+ * Checks whether the query error should be thrown to the nearest error boundary: the query errored
21
+ * and isn't fetching, the boundary hasn't been reset, and either `suspense` is enabled with no data
22
+ * or `throwOnError` says so.
23
+ * @param params - The observer `result`, the `errorResetBoundary`, the `throwOnError` option, the
24
+ * `query`, and the `suspense` option.
25
+ * @returns `true` if the error should be thrown.
26
+ */
6
27
  export declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, suspense }: {
7
28
  result: QueryObserverResult<TData, TError>;
8
29
  errorResetBoundary: QueryErrorResetBoundaryValue;
@@ -1 +1 @@
1
- {"version":3,"file":"errorBoundaryUtils.d.ts","names":[],"sources":["../../src/errorBoundaryUtils.ts"],"mappings":";;;qBAYa,kCACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,8BACP,cACA,QACA,OACA,YACA,YAEF,oBAAoB,8BACpB,OAAO,MAAM,cAAc,QAAQ,YAAY;qBAepC,6BACX,oBAAoB;qBAOT,cACX,OACA,QACA,cACA,YACA,kBAAkB,YAClB,QAAA,oBAAA,cAAA,OAAA;EAOA,QAAQ,oBAAoB,OAAO;EACnC,oBAAoB;EACpB,cAAc,aAAa,cAAc,QAAQ,YAAY;EAC7D,OAAO,MAAM,cAAc,QAAQ,YAAY;EAC/C"}
1
+ {"version":3,"file":"errorBoundaryUtils.d.ts","names":[],"sources":["../../src/errorBoundaryUtils.ts"],"mappings":";;;;;;;;;;;qBAoBa,kCACX,cACA,QACA,OACA,YACA,kBAAkB,UAElB,SAAS,8BACP,cACA,QACA,OACA,YACA,YAEF,oBAAoB,8BACpB,OAAO,MAAM,cAAc,QAAQ,YAAY;;;;;;qBAoBpC,6BACX,oBAAoB;;;;;;;;;qBAeT,cACX,OACA,QACA,cACA,YACA,kBAAkB,YAClB,QAAA,oBAAA,cAAA,OAAA;EAOA,QAAQ,oBAAoB,OAAO;EACnC,oBAAoB;EACpB,cAAc,aAAa,cAAc,QAAQ,YAAY;EAC7D,OAAO,MAAM,cAAc,QAAQ,YAAY;EAC/C"}
@@ -2,17 +2,38 @@
2
2
  import * as React from "react";
3
3
  import { shouldThrowError } from "@tanstack/query-core";
4
4
  //#region src/errorBoundaryUtils.ts
5
+ /**
6
+ * Turns off `retryOnMount` for a query that throws its errors (with `suspense` or `throwOnError`),
7
+ * unless the error boundary has been reset, so a remount doesn't retry the failed query before the
8
+ * user resets the boundary. Mutates the options.
9
+ * @param options - The defaulted query options to adjust.
10
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
11
+ * @param query - The query, used to evaluate a `throwOnError` function against its error.
12
+ */
5
13
  const ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
6
14
  const throwOnError = (query === null || query === void 0 ? void 0 : query.state.error) && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
7
15
  if (options.suspense || throwOnError) {
8
16
  if (!errorResetBoundary.isReset()) options.retryOnMount = false;
9
17
  }
10
18
  };
19
+ /**
20
+ * Clears the reset state of the error boundary after the component mounts, so later errors are
21
+ * thrown to the boundary again.
22
+ * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.
23
+ */
11
24
  const useClearResetErrorBoundary = (errorResetBoundary) => {
12
25
  React.useEffect(() => {
13
26
  errorResetBoundary.clearReset();
14
27
  }, [errorResetBoundary]);
15
28
  };
29
+ /**
30
+ * Checks whether the query error should be thrown to the nearest error boundary: the query errored
31
+ * and isn't fetching, the boundary hasn't been reset, and either `suspense` is enabled with no data
32
+ * or `throwOnError` says so.
33
+ * @param params - The observer `result`, the `errorResetBoundary`, the `throwOnError` option, the
34
+ * `query`, and the `suspense` option.
35
+ * @returns `true` if the error should be thrown.
36
+ */
16
37
  const getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
17
38
  return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
18
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"errorBoundaryUtils.js","names":[],"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (options.suspense || throwOnError) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;AAYA,MAAa,mCAOX,SAOA,oBACA,UACG;CACH,MAAM,gBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IACJ,MAAO,MAAM,UAAS,OAAO,QAAQ,iBAAiB,aAClD,iBAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;CAEd,IAAI,QAAQ,YAAY,cAElB;MAAA,CAAC,mBAAmB,QAAQ,GAC9B,QAAQ,eAAe;CAAA;AAG7B;AAEA,MAAa,8BACX,uBACG;CACH,MAAM,gBAAgB;EACpB,mBAAmB,WAAW;CAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;AAEA,MAAa,eAMX,EACA,QACA,oBACA,cACA,OACA,eAOI;CACJ,OACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,KAAA,KAC5B,iBAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D"}
1
+ {"version":3,"file":"errorBoundaryUtils.js","names":[],"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\n/**\n * Turns off `retryOnMount` for a query that throws its errors (with `suspense` or `throwOnError`),\n * unless the error boundary has been reset, so a remount doesn't retry the failed query before the\n * user resets the boundary. Mutates the options.\n * @param options - The defaulted query options to adjust.\n * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.\n * @param query - The query, used to evaluate a `throwOnError` function against its error.\n */\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (options.suspense || throwOnError) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\n/**\n * Clears the reset state of the error boundary after the component mounts, so later errors are\n * thrown to the boundary again.\n * @param errorResetBoundary - The value of the nearest `QueryErrorResetBoundary`.\n */\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\n/**\n * Checks whether the query error should be thrown to the nearest error boundary: the query errored\n * and isn't fetching, the boundary hasn't been reset, and either `suspense` is enabled with no data\n * or `throwOnError` says so.\n * @param params - The observer `result`, the `errorResetBoundary`, the `throwOnError` option, the\n * `query`, and the `suspense` option.\n * @returns `true` if the error should be thrown.\n */\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,mCAOX,SAOA,oBACA,UACG;CACH,MAAM,gBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IACJ,MAAO,MAAM,UAAS,OAAO,QAAQ,iBAAiB,aAClD,iBAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;CAEd,IAAI,QAAQ,YAAY,cAElB;MAAA,CAAC,mBAAmB,QAAQ,GAC9B,QAAQ,eAAe;CAAA;AAG7B;;;;;;AAOA,MAAa,8BACX,uBACG;CACH,MAAM,gBAAgB;EACpB,mBAAmB,WAAW;CAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;;;;;;;;;AAUA,MAAa,eAMX,EACA,QACA,oBACA,cACA,OACA,eAOI;CACJ,OACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,KAAA,KAC5B,iBAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"infiniteQueryOptions.cjs","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n QueryKeyWithDataTag,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`\n * may be `undefined` while the query is `pending`.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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 | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set and\n * `queryFn` is not `skipToken` — same as {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be\n * `skipToken`.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\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 UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is\n * never `undefined` (unless a `select` changes `TData` to include `undefined`).\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n *\n * This overload is selected when `initialData` is set.\n *\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n *\n * @example\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const projectsOptions = infiniteQueryOptions({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\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(projectsOptions)\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 infiniteQueryOptions<\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): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n *\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n *\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 *\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n *\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages (from a button click or\n * automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.\n *\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 *\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n */\nexport function infiniteQueryOptions<\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): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;AA4TA,SAAgB,qBAAqB,SAAkB;CACrD,OAAO;AACT"}
1
+ {"version":3,"file":"infiniteQueryOptions.cjs","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n QueryKeyWithDataTag,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`\n * may be `undefined` while the query is `pending`.\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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 | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set and\n * `queryFn` is not `skipToken` — same as {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be\n * `skipToken`.\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\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 UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is\n * never `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\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 * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @example\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const projectsOptions = infiniteQueryOptions({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\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(projectsOptions)\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 infiniteQueryOptions<\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): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages (from a button click or\n * automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 infiniteQueryOptions<\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): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;AAiTA,SAAgB,qBAAqB,SAAkB;CACrD,OAAO;AACT"}
@@ -4,7 +4,6 @@ import { DefaultError, InfiniteData, InitialDataFunction, NonUndefinedGuard, Omi
4
4
  /**
5
5
  * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`
6
6
  * may be `undefined` while the query is `pending`.
7
- *
8
7
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
9
8
  * @template TError - The type of errors your `queryFn` may throw.
10
9
  * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
@@ -26,7 +25,6 @@ export type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultEr
26
25
  * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set and
27
26
  * `queryFn` is not `skipToken` — same as {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be
28
27
  * `skipToken`.
29
- *
30
28
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
31
29
  * @template TError - The type of errors your `queryFn` may throw.
32
30
  * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
@@ -46,7 +44,6 @@ export type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError,
46
44
  /**
47
45
  * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is
48
46
  * never `undefined` (unless a `select` changes `TData` to include `undefined`).
49
- *
50
47
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
51
48
  * @template TError - The type of errors your `queryFn` may throw.
52
49
  * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
@@ -70,13 +67,11 @@ export type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultErro
70
67
  * `options.queryKey` is required and is the query key to generate options for.
71
68
  *
72
69
  * This overload is selected when `initialData` is set.
73
- *
74
- * @see {@link useInfiniteQuery} to run an infinite query with these options.
75
70
  * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.
76
71
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
77
72
  * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or
78
73
  * automatically as the user scrolls.
79
- *
74
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
80
75
  * @example
81
76
  * ```tsx
82
77
  * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
@@ -110,11 +105,11 @@ export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError
110
105
  * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
111
106
  * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
112
107
  * `options.queryKey` is required and is the query key to generate options for.
113
- *
108
+ * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
114
109
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
115
110
  * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or
116
111
  * automatically as the user scrolls.
117
- *
112
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
118
113
  * @example
119
114
  * A parameterized factory, so the same options object can be reused per `postId`:
120
115
  * ```tsx
@@ -141,20 +136,17 @@ export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError
141
136
  * )
142
137
  * }
143
138
  * ```
144
- *
145
- * @see {@link useInfiniteQuery} to run an infinite query with these options.
146
- * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
147
139
  */
148
140
  export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
149
141
  /**
150
142
  * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
151
143
  * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
152
144
  * `options.queryKey` is required and is the query key to generate options for.
153
- *
145
+ * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
154
146
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
155
147
  * @remarks See {@link useInfiniteQuery} for examples that fetch further pages (from a button click or
156
148
  * automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.
157
- *
149
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
158
150
  * @example
159
151
  * A parameterized factory, so the same options object can be reused per `postId`:
160
152
  * ```tsx
@@ -181,9 +173,6 @@ export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError
181
173
  * )
182
174
  * }
183
175
  * ```
184
- *
185
- * @see {@link useInfiniteQuery} to run an infinite query with these options.
186
- * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
187
176
  */
188
177
  export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
189
178
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"infiniteQueryOptions.d.cts","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"mappings":";;;;;;;;;;;;;;YAuBY,oCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,0BAEI,kBAAkB,aAAa,cAAc,eAC7C,oBACE,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;YAgBzC,+BACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,UACF,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;;;EAShE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;;YAeQ,kCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,aACI,kBAAkB,aAAa,cAAc,sBACtC,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6C1C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,cAED,kCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,+BACP,cACA,QACA,OACA,WACA,cAED,+BACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,cAED,oCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe"}
1
+ {"version":3,"file":"infiniteQueryOptions.d.cts","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"mappings":";;;;;;;;;;;;;YAsBY,oCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,0BAEI,kBAAkB,aAAa,cAAc,eAC7C,oBACE,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;YAezC,+BACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,UACF,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;;;EAShE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;YAcQ,kCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,aACI,kBAAkB,aAAa,cAAc,sBACtC,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2C1C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,cAED,kCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,+BACP,cACA,QACA,OACA,WACA,cAED,+BACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,cAED,oCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe"}
@@ -4,7 +4,6 @@ import { DefaultError, InfiniteData, InitialDataFunction, NonUndefinedGuard, Omi
4
4
  /**
5
5
  * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`
6
6
  * may be `undefined` while the query is `pending`.
7
- *
8
7
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
9
8
  * @template TError - The type of errors your `queryFn` may throw.
10
9
  * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
@@ -26,7 +25,6 @@ export type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultEr
26
25
  * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set and
27
26
  * `queryFn` is not `skipToken` — same as {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be
28
27
  * `skipToken`.
29
- *
30
28
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
31
29
  * @template TError - The type of errors your `queryFn` may throw.
32
30
  * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
@@ -46,7 +44,6 @@ export type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError,
46
44
  /**
47
45
  * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is
48
46
  * never `undefined` (unless a `select` changes `TData` to include `undefined`).
49
- *
50
47
  * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.
51
48
  * @template TError - The type of errors your `queryFn` may throw.
52
49
  * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,
@@ -70,13 +67,11 @@ export type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultErro
70
67
  * `options.queryKey` is required and is the query key to generate options for.
71
68
  *
72
69
  * This overload is selected when `initialData` is set.
73
- *
74
- * @see {@link useInfiniteQuery} to run an infinite query with these options.
75
70
  * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.
76
71
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
77
72
  * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or
78
73
  * automatically as the user scrolls.
79
- *
74
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
80
75
  * @example
81
76
  * ```tsx
82
77
  * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
@@ -110,11 +105,11 @@ export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError
110
105
  * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
111
106
  * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
112
107
  * `options.queryKey` is required and is the query key to generate options for.
113
- *
108
+ * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
114
109
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
115
110
  * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or
116
111
  * automatically as the user scrolls.
117
- *
112
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
118
113
  * @example
119
114
  * A parameterized factory, so the same options object can be reused per `postId`:
120
115
  * ```tsx
@@ -141,20 +136,17 @@ export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError
141
136
  * )
142
137
  * }
143
138
  * ```
144
- *
145
- * @see {@link useInfiniteQuery} to run an infinite query with these options.
146
- * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
147
139
  */
148
140
  export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
149
141
  /**
150
142
  * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.
151
143
  * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.
152
144
  * `options.queryKey` is required and is the query key to generate options for.
153
- *
145
+ * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
154
146
  * @returns The same options object, typed so that `queryKey` carries the inferred data type.
155
147
  * @remarks See {@link useInfiniteQuery} for examples that fetch further pages (from a button click or
156
148
  * automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.
157
- *
149
+ * @see {@link useInfiniteQuery} to run an infinite query with these options.
158
150
  * @example
159
151
  * A parameterized factory, so the same options object can be reused per `postId`:
160
152
  * ```tsx
@@ -181,9 +173,6 @@ export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError
181
173
  * )
182
174
  * }
183
175
  * ```
184
- *
185
- * @see {@link useInfiniteQuery} to run an infinite query with these options.
186
- * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.
187
176
  */
188
177
  export declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
189
178
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"infiniteQueryOptions.d.ts","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"mappings":";;;;;;;;;;;;;;YAuBY,oCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,0BAEI,kBAAkB,aAAa,cAAc,eAC7C,oBACE,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;YAgBzC,+BACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,UACF,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;;;EAShE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;;YAeQ,kCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,aACI,kBAAkB,aAAa,cAAc,sBACtC,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6C1C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,cAED,kCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,+BACP,cACA,QACA,OACA,WACA,cAED,+BACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,cAED,oCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe"}
1
+ {"version":3,"file":"infiniteQueryOptions.d.ts","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"mappings":";;;;;;;;;;;;;YAsBY,oCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,0BAEI,kBAAkB,aAAa,cAAc,eAC7C,oBACE,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;YAezC,+BACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,UACF,wBAAwB,cAAc,QAAQ,OAAO,WAAW;;;;;;;EAShE,UAAU,QACR,wBACE,cACA,QACA,OACA,WACA,wBAEF;;;;;;;;;;;;YAcQ,kCACV,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,wBACE,wBACF,cACA,QACA,OACA,WACA;;;;;;;;EASA,aACI,kBAAkB,aAAa,cAAc,sBACtC,kBAAkB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2C1C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,kCACP,cACA,QACA,OACA,WACA,cAED,kCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,+BACP,cACA,QACA,OACA,WACA,cAED,+BACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsC7C,qBACd,cACA,SAAS,cACT,QAAQ,aAAa,eACrB,kBAAkB,WAAW,UAC7B,sBAEA,SAAS,oCACP,cACA,QACA,OACA,WACA,cAED,oCACD,cACA,QACA,OACA,WACA,cAEA,oBAAoB,WAAW,aAAa,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"infiniteQueryOptions.js","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n QueryKeyWithDataTag,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`\n * may be `undefined` while the query is `pending`.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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 | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set and\n * `queryFn` is not `skipToken` — same as {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be\n * `skipToken`.\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\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 UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is\n * never `undefined` (unless a `select` changes `TData` to include `undefined`).\n *\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n *\n * This overload is selected when `initialData` is set.\n *\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @param options - The {@link DefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`, with `initialData` set.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n *\n * @example\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const projectsOptions = infiniteQueryOptions({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\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(projectsOptions)\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 infiniteQueryOptions<\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): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n *\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n *\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 *\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n */\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n *\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages (from a button click or\n * automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.\n *\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 *\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n */\nexport function infiniteQueryOptions<\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): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AA4TA,SAAgB,qBAAqB,SAAkB;CACrD,OAAO;AACT"}
1
+ {"version":3,"file":"infiniteQueryOptions.js","names":[],"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n QueryKeyWithDataTag,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set — `data`\n * may be `undefined` while the query is `pending`.\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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 | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when no `initialData` is set and\n * `queryFn` is not `skipToken` — same as {@link UndefinedInitialDataInfiniteOptions}, but `queryFn` may not be\n * `skipToken`.\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\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 UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\n/**\n * The options accepted by the `infiniteQueryOptions` overload selected when `initialData` is set — `data` is\n * never `undefined` (unless a `select` changes `TData` to include `undefined`).\n * @template TQueryFnData - The type of a single page, as your `queryFn` resolves it.\n * @template TError - The type of errors your `queryFn` may throw.\n * @template TData - The type `data` ends up as after `select` runs — defaults to `InfiniteData<TQueryFnData>`,\n * the shape of all fetched pages plus their page params.\n * @template TQueryKey - The type of your `queryKey`.\n * @template TPageParam - The type of the parameter passed to `queryFn` to fetch a given page.\n */\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\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<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\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 * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @example\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const projectsOptions = infiniteQueryOptions({\n * queryKey: ['projects'],\n * queryFn: ({ pageParam }) => fetchProjects(pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * initialData: { pages: [], pageParams: [] },\n * })\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(projectsOptions)\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 infiniteQueryOptions<\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): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n * @param options - The {@link UnusedSkipTokenInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages, from a button click or\n * automatically as the user scrolls.\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\n/**\n * You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`.\n * These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`.\n * `options.queryKey` is required and is the query key to generate options for.\n * @param options - The {@link UndefinedInitialDataInfiniteOptions} to use — everything you can pass to `useInfiniteQuery`.\n * @returns The same options object, typed so that `queryKey` carries the inferred data type.\n * @remarks See {@link useInfiniteQuery} for examples that fetch further pages (from a button click or\n * automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.\n * @see {@link useInfiniteQuery} to run an infinite query with these options.\n * @example\n * A parameterized factory, so the same options object can be reused per `postId`:\n * ```tsx\n * import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'\n *\n * export const commentsOptions = (postId: string) =>\n * infiniteQueryOptions({\n * queryKey: ['post', postId, 'comments'],\n * queryFn: ({ pageParam }) => fetchComments(postId, pageParam),\n * initialPageParam: 0,\n * getNextPageParam: (lastPage) => lastPage.nextId,\n * })\n *\n * function Comments({ postId }: { postId: string }) {\n * const { data, isPending, isError, error } = useInfiniteQuery(commentsOptions(postId))\n *\n * if (isPending) 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 infiniteQueryOptions<\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): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> &\n QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAiTA,SAAgB,qBAAqB,SAAkB;CACrD,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutationOptions.cjs","names":[],"sources":["../../src/mutationOptions.ts"],"sourcesContent":["import type { DefaultError, WithRequired } from '@tanstack/query-core'\nimport type { UseMutationOptions } from './types'\n\n/**\n * You can generally pass everything to `mutationOptions` that you can also pass to `useMutation`. A\n * `mutationKey` is required on this overload so the mutation can be looked up later, e.g. with\n * `useMutationState`.\n *\n * @see {@link useMutation} to run the mutation these options describe.\n * @param options - The mutation options to use, identical to what you'd pass to `useMutation`, with a\n * required `mutationKey`.\n * @returns The same options object, unchanged.\n *\n * @example\n * Looking the mutation up elsewhere via its `mutationKey`, e.g. for a global \"saving…\" indicator:\n * ```tsx\n * import { mutationOptions, useMutationState } from '@tanstack/react-query'\n *\n * const createPostOptions = mutationOptions({\n * mutationKey: ['posts', 'create'],\n * mutationFn: createPost,\n * })\n *\n * function SavingIndicator() {\n * const isCreatingPost = useMutationState({\n * filters: { mutationKey: createPostOptions.mutationKey, status: 'pending' },\n * }).length > 0\n *\n * return isCreatingPost ? <span>Saving…</span> : null\n * }\n * ```\n */\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\n/**\n * You can generally pass everything to `mutationOptions` that you can also pass to `useMutation`. No\n * `mutationKey` is required on this overload — use this when you don't need to target the mutation via a\n * `mutationKey` filter later (e.g. with `useMutationState`); it can still be observed through other filters,\n * such as `status`.\n *\n * @see {@link useMutation} to run the mutation these options describe.\n * @param options - The mutation options to use, identical to what you'd pass to `useMutation`, without a\n * `mutationKey`.\n * @returns The same options object, unchanged.\n * @remarks See the other overload's example for looking a mutation up via `useMutationState`.\n *\n * @example\n * ```tsx\n * import { mutationOptions, useMutation } from '@tanstack/react-query'\n *\n * export const createPostOptions = mutationOptions({\n * mutationFn: createPost,\n * })\n *\n * function CreatePost() {\n * const mutation = useMutation(createPostOptions)\n * return <button onClick={() => mutation.mutate({ title: 'Hello' })}>Create</button>\n * }\n * ```\n */\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n): UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {\n return options\n}\n"],"mappings":";;AAsFA,SAAgB,gBAMd,SACgE;CAChE,OAAO;AACT"}
1
+ {"version":3,"file":"mutationOptions.cjs","names":[],"sources":["../../src/mutationOptions.ts"],"sourcesContent":["import type { DefaultError, WithRequired } from '@tanstack/query-core'\nimport type { UseMutationOptions } from './types'\n\n/**\n * You can generally pass everything to `mutationOptions` that you can also pass to `useMutation`. A\n * `mutationKey` is required on this overload so the mutation can be looked up later, e.g. with\n * `useMutationState`.\n * @param options - The mutation options to use, identical to what you'd pass to `useMutation`, with a\n * required `mutationKey`.\n * @returns The same options object, unchanged.\n * @see {@link useMutation} to run the mutation these options describe.\n * @example\n * Looking the mutation up elsewhere via its `mutationKey`, e.g. for a global \"saving…\" indicator:\n * ```tsx\n * import { mutationOptions, useMutationState } from '@tanstack/react-query'\n *\n * const createPostOptions = mutationOptions({\n * mutationKey: ['posts', 'create'],\n * mutationFn: createPost,\n * })\n *\n * function SavingIndicator() {\n * const isCreatingPost = useMutationState({\n * filters: { mutationKey: createPostOptions.mutationKey, status: 'pending' },\n * }).length > 0\n *\n * return isCreatingPost ? <span>Saving…</span> : null\n * }\n * ```\n */\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\n/**\n * You can generally pass everything to `mutationOptions` that you can also pass to `useMutation`. No\n * `mutationKey` is required on this overload — use this when you don't need to target the mutation via a\n * `mutationKey` filter later (e.g. with `useMutationState`); it can still be observed through other filters,\n * such as `status`.\n * @param options - The mutation options to use, identical to what you'd pass to `useMutation`, without a\n * `mutationKey`.\n * @returns The same options object, unchanged.\n * @remarks See the other overload's example for looking a mutation up via `useMutationState`.\n * @see {@link useMutation} to run the mutation these options describe.\n * @example\n * ```tsx\n * import { mutationOptions, useMutation } from '@tanstack/react-query'\n *\n * export const createPostOptions = mutationOptions({\n * mutationFn: createPost,\n * })\n *\n * function CreatePost() {\n * const mutation = useMutation(createPostOptions)\n * return <button onClick={() => mutation.mutate({ title: 'Hello' })}>Create</button>\n * }\n * ```\n */\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n): UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {\n return options\n}\n"],"mappings":";;AAkFA,SAAgB,gBAMd,SACgE;CAChE,OAAO;AACT"}