@tanstack/query-core 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 (359) hide show
  1. package/build/legacy/environmentManager.cjs +3 -1
  2. package/build/legacy/environmentManager.cjs.map +1 -1
  3. package/build/legacy/environmentManager.d.cts +6 -1
  4. package/build/legacy/environmentManager.d.cts.map +1 -1
  5. package/build/legacy/environmentManager.d.ts +6 -1
  6. package/build/legacy/environmentManager.d.ts.map +1 -1
  7. package/build/legacy/environmentManager.js +3 -1
  8. package/build/legacy/environmentManager.js.map +1 -1
  9. package/build/legacy/focusManager.cjs +4 -2
  10. package/build/legacy/focusManager.cjs.map +1 -1
  11. package/build/legacy/focusManager.d.cts +5 -3
  12. package/build/legacy/focusManager.d.cts.map +1 -1
  13. package/build/legacy/focusManager.d.ts +5 -3
  14. package/build/legacy/focusManager.d.ts.map +1 -1
  15. package/build/legacy/focusManager.js +4 -2
  16. package/build/legacy/focusManager.js.map +1 -1
  17. package/build/legacy/{hydration-B9t5w6NC.d.ts → hydration-Bf0oMcwO.d.ts} +1411 -129
  18. package/build/legacy/hydration-Bf0oMcwO.d.ts.map +1 -0
  19. package/build/legacy/{hydration-Br9VIGXa.d.cts → hydration-C6zghADG.d.cts} +1411 -129
  20. package/build/legacy/hydration-C6zghADG.d.cts.map +1 -0
  21. package/build/legacy/hydration.cjs +35 -0
  22. package/build/legacy/hydration.cjs.map +1 -1
  23. package/build/legacy/hydration.d.cts +1 -1
  24. package/build/legacy/hydration.d.ts +1 -1
  25. package/build/legacy/hydration.js +35 -0
  26. package/build/legacy/hydration.js.map +1 -1
  27. package/build/legacy/index.d.cts +1 -1
  28. package/build/legacy/index.d.ts +1 -1
  29. package/build/legacy/infiniteQueryBehavior.cjs +29 -0
  30. package/build/legacy/infiniteQueryBehavior.cjs.map +1 -1
  31. package/build/legacy/infiniteQueryBehavior.d.cts +16 -1
  32. package/build/legacy/infiniteQueryBehavior.d.cts.map +1 -1
  33. package/build/legacy/infiniteQueryBehavior.d.ts +16 -1
  34. package/build/legacy/infiniteQueryBehavior.d.ts.map +1 -1
  35. package/build/legacy/infiniteQueryBehavior.js +29 -0
  36. package/build/legacy/infiniteQueryBehavior.js.map +1 -1
  37. package/build/legacy/infiniteQueryObserver.cjs +13 -7
  38. package/build/legacy/infiniteQueryObserver.cjs.map +1 -1
  39. package/build/legacy/infiniteQueryObserver.d.cts +15 -9
  40. package/build/legacy/infiniteQueryObserver.d.cts.map +1 -1
  41. package/build/legacy/infiniteQueryObserver.d.ts +15 -9
  42. package/build/legacy/infiniteQueryObserver.d.ts.map +1 -1
  43. package/build/legacy/infiniteQueryObserver.js +13 -7
  44. package/build/legacy/infiniteQueryObserver.js.map +1 -1
  45. package/build/legacy/mutation.cjs +27 -10
  46. package/build/legacy/mutation.cjs.map +1 -1
  47. package/build/legacy/mutation.d.cts +1 -1
  48. package/build/legacy/mutation.d.ts +1 -1
  49. package/build/legacy/mutation.js +27 -10
  50. package/build/legacy/mutation.js.map +1 -1
  51. package/build/legacy/mutationCache.cjs +53 -12
  52. package/build/legacy/mutationCache.cjs.map +1 -1
  53. package/build/legacy/mutationCache.d.cts +1 -1
  54. package/build/legacy/mutationCache.d.ts +1 -1
  55. package/build/legacy/mutationCache.js +53 -12
  56. package/build/legacy/mutationCache.js.map +1 -1
  57. package/build/legacy/mutationObserver.cjs +27 -16
  58. package/build/legacy/mutationObserver.cjs.map +1 -1
  59. package/build/legacy/mutationObserver.d.cts +1 -1
  60. package/build/legacy/mutationObserver.d.ts +1 -1
  61. package/build/legacy/mutationObserver.js +27 -16
  62. package/build/legacy/mutationObserver.js.map +1 -1
  63. package/build/legacy/notifyManager.cjs +12 -2
  64. package/build/legacy/notifyManager.cjs.map +1 -1
  65. package/build/legacy/notifyManager.d.cts +19 -4
  66. package/build/legacy/notifyManager.d.cts.map +1 -1
  67. package/build/legacy/notifyManager.d.ts +19 -4
  68. package/build/legacy/notifyManager.d.ts.map +1 -1
  69. package/build/legacy/notifyManager.js +12 -2
  70. package/build/legacy/notifyManager.js.map +1 -1
  71. package/build/legacy/onlineManager.cjs +4 -2
  72. package/build/legacy/onlineManager.cjs.map +1 -1
  73. package/build/legacy/onlineManager.d.cts +5 -3
  74. package/build/legacy/onlineManager.d.cts.map +1 -1
  75. package/build/legacy/onlineManager.d.ts +5 -3
  76. package/build/legacy/onlineManager.d.ts.map +1 -1
  77. package/build/legacy/onlineManager.js +4 -2
  78. package/build/legacy/onlineManager.js.map +1 -1
  79. package/build/legacy/queriesObserver.cjs +15 -3
  80. package/build/legacy/queriesObserver.cjs.map +1 -1
  81. package/build/legacy/queriesObserver.d.cts +14 -5
  82. package/build/legacy/queriesObserver.d.cts.map +1 -1
  83. package/build/legacy/queriesObserver.d.ts +14 -5
  84. package/build/legacy/queriesObserver.d.ts.map +1 -1
  85. package/build/legacy/queriesObserver.js +15 -3
  86. package/build/legacy/queriesObserver.js.map +1 -1
  87. package/build/legacy/query.cjs +89 -15
  88. package/build/legacy/query.cjs.map +1 -1
  89. package/build/legacy/query.d.cts +1 -1
  90. package/build/legacy/query.d.ts +1 -1
  91. package/build/legacy/query.js +89 -15
  92. package/build/legacy/query.js.map +1 -1
  93. package/build/legacy/queryCache.cjs +34 -12
  94. package/build/legacy/queryCache.cjs.map +1 -1
  95. package/build/legacy/queryCache.d.cts +1 -1
  96. package/build/legacy/queryCache.d.ts +1 -1
  97. package/build/legacy/queryCache.js +34 -12
  98. package/build/legacy/queryCache.js.map +1 -1
  99. package/build/legacy/queryClient.cjs +104 -32
  100. package/build/legacy/queryClient.cjs.map +1 -1
  101. package/build/legacy/queryClient.d.cts +1 -1
  102. package/build/legacy/queryClient.d.ts +1 -1
  103. package/build/legacy/queryClient.js +104 -32
  104. package/build/legacy/queryClient.js.map +1 -1
  105. package/build/legacy/queryObserver.cjs +78 -6
  106. package/build/legacy/queryObserver.cjs.map +1 -1
  107. package/build/legacy/queryObserver.d.cts +1 -1
  108. package/build/legacy/queryObserver.d.ts +1 -1
  109. package/build/legacy/queryObserver.js +78 -6
  110. package/build/legacy/queryObserver.js.map +1 -1
  111. package/build/{modern/removable-0GzhW1PK.d.cts → legacy/removable-Cw9GNGyK.d.cts} +17 -1
  112. package/build/legacy/removable-Cw9GNGyK.d.cts.map +1 -0
  113. package/build/legacy/{removable-0GzhW1PK.d.cts → removable-Cw9GNGyK.d.ts} +17 -1
  114. package/build/legacy/removable-Cw9GNGyK.d.ts.map +1 -0
  115. package/build/legacy/removable.cjs +12 -0
  116. package/build/legacy/removable.cjs.map +1 -1
  117. package/build/legacy/removable.d.cts +1 -1
  118. package/build/legacy/removable.d.ts +1 -1
  119. package/build/legacy/removable.js +12 -0
  120. package/build/legacy/removable.js.map +1 -1
  121. package/build/legacy/retryer.cjs +26 -4
  122. package/build/legacy/retryer.cjs.map +1 -1
  123. package/build/legacy/retryer.d.cts +1 -1
  124. package/build/legacy/retryer.d.ts +1 -1
  125. package/build/legacy/retryer.js +26 -4
  126. package/build/legacy/retryer.js.map +1 -1
  127. package/build/legacy/streamedQuery.cjs +3 -1
  128. package/build/legacy/streamedQuery.cjs.map +1 -1
  129. package/build/legacy/streamedQuery.d.cts +4 -2
  130. package/build/legacy/streamedQuery.d.cts.map +1 -1
  131. package/build/legacy/streamedQuery.d.ts +4 -2
  132. package/build/legacy/streamedQuery.d.ts.map +1 -1
  133. package/build/legacy/streamedQuery.js +3 -1
  134. package/build/legacy/streamedQuery.js.map +1 -1
  135. package/build/{modern/subscribable-CysQ0tne.d.cts → legacy/subscribable-czlHOxMP.d.cts} +11 -1
  136. package/build/legacy/subscribable-czlHOxMP.d.cts.map +1 -0
  137. package/build/legacy/{subscribable-CysQ0tne.d.cts → subscribable-czlHOxMP.d.ts} +11 -1
  138. package/build/legacy/subscribable-czlHOxMP.d.ts.map +1 -0
  139. package/build/legacy/subscribable.cjs +10 -0
  140. package/build/legacy/subscribable.cjs.map +1 -1
  141. package/build/legacy/subscribable.d.cts +1 -1
  142. package/build/legacy/subscribable.d.ts +1 -1
  143. package/build/legacy/subscribable.js +10 -0
  144. package/build/legacy/subscribable.js.map +1 -1
  145. package/build/legacy/timeoutManager.cjs +11 -6
  146. package/build/legacy/timeoutManager.cjs.map +1 -1
  147. package/build/legacy/timeoutManager.d.cts +23 -6
  148. package/build/legacy/timeoutManager.d.cts.map +1 -1
  149. package/build/legacy/timeoutManager.d.ts +23 -6
  150. package/build/legacy/timeoutManager.d.ts.map +1 -1
  151. package/build/legacy/timeoutManager.js +11 -6
  152. package/build/legacy/timeoutManager.js.map +1 -1
  153. package/build/legacy/types.cjs.map +1 -1
  154. package/build/legacy/types.d.cts +1 -1
  155. package/build/legacy/types.d.ts +1 -1
  156. package/build/legacy/types.js.map +1 -1
  157. package/build/legacy/utils.cjs +117 -8
  158. package/build/legacy/utils.cjs.map +1 -1
  159. package/build/legacy/utils.d.cts +1 -1
  160. package/build/legacy/utils.d.ts +1 -1
  161. package/build/legacy/utils.js +117 -8
  162. package/build/legacy/utils.js.map +1 -1
  163. package/build/modern/environmentManager.cjs +3 -1
  164. package/build/modern/environmentManager.cjs.map +1 -1
  165. package/build/modern/environmentManager.d.cts +6 -1
  166. package/build/modern/environmentManager.d.cts.map +1 -1
  167. package/build/modern/environmentManager.d.ts +6 -1
  168. package/build/modern/environmentManager.d.ts.map +1 -1
  169. package/build/modern/environmentManager.js +3 -1
  170. package/build/modern/environmentManager.js.map +1 -1
  171. package/build/modern/focusManager.cjs +4 -2
  172. package/build/modern/focusManager.cjs.map +1 -1
  173. package/build/modern/focusManager.d.cts +5 -3
  174. package/build/modern/focusManager.d.cts.map +1 -1
  175. package/build/modern/focusManager.d.ts +5 -3
  176. package/build/modern/focusManager.d.ts.map +1 -1
  177. package/build/modern/focusManager.js +4 -2
  178. package/build/modern/focusManager.js.map +1 -1
  179. package/build/modern/{hydration-B9t5w6NC.d.ts → hydration-Bf0oMcwO.d.ts} +1411 -129
  180. package/build/modern/hydration-Bf0oMcwO.d.ts.map +1 -0
  181. package/build/modern/{hydration-Br9VIGXa.d.cts → hydration-C6zghADG.d.cts} +1411 -129
  182. package/build/modern/hydration-C6zghADG.d.cts.map +1 -0
  183. package/build/modern/hydration.cjs +35 -0
  184. package/build/modern/hydration.cjs.map +1 -1
  185. package/build/modern/hydration.d.cts +1 -1
  186. package/build/modern/hydration.d.ts +1 -1
  187. package/build/modern/hydration.js +35 -0
  188. package/build/modern/hydration.js.map +1 -1
  189. package/build/modern/index.d.cts +1 -1
  190. package/build/modern/index.d.ts +1 -1
  191. package/build/modern/infiniteQueryBehavior.cjs +29 -0
  192. package/build/modern/infiniteQueryBehavior.cjs.map +1 -1
  193. package/build/modern/infiniteQueryBehavior.d.cts +16 -1
  194. package/build/modern/infiniteQueryBehavior.d.cts.map +1 -1
  195. package/build/modern/infiniteQueryBehavior.d.ts +16 -1
  196. package/build/modern/infiniteQueryBehavior.d.ts.map +1 -1
  197. package/build/modern/infiniteQueryBehavior.js +29 -0
  198. package/build/modern/infiniteQueryBehavior.js.map +1 -1
  199. package/build/modern/infiniteQueryObserver.cjs +13 -7
  200. package/build/modern/infiniteQueryObserver.cjs.map +1 -1
  201. package/build/modern/infiniteQueryObserver.d.cts +15 -9
  202. package/build/modern/infiniteQueryObserver.d.cts.map +1 -1
  203. package/build/modern/infiniteQueryObserver.d.ts +15 -9
  204. package/build/modern/infiniteQueryObserver.d.ts.map +1 -1
  205. package/build/modern/infiniteQueryObserver.js +13 -7
  206. package/build/modern/infiniteQueryObserver.js.map +1 -1
  207. package/build/modern/mutation.cjs +27 -10
  208. package/build/modern/mutation.cjs.map +1 -1
  209. package/build/modern/mutation.d.cts +1 -1
  210. package/build/modern/mutation.d.ts +1 -1
  211. package/build/modern/mutation.js +27 -10
  212. package/build/modern/mutation.js.map +1 -1
  213. package/build/modern/mutationCache.cjs +53 -12
  214. package/build/modern/mutationCache.cjs.map +1 -1
  215. package/build/modern/mutationCache.d.cts +1 -1
  216. package/build/modern/mutationCache.d.ts +1 -1
  217. package/build/modern/mutationCache.js +53 -12
  218. package/build/modern/mutationCache.js.map +1 -1
  219. package/build/modern/mutationObserver.cjs +23 -12
  220. package/build/modern/mutationObserver.cjs.map +1 -1
  221. package/build/modern/mutationObserver.d.cts +1 -1
  222. package/build/modern/mutationObserver.d.ts +1 -1
  223. package/build/modern/mutationObserver.js +23 -12
  224. package/build/modern/mutationObserver.js.map +1 -1
  225. package/build/modern/notifyManager.cjs +12 -2
  226. package/build/modern/notifyManager.cjs.map +1 -1
  227. package/build/modern/notifyManager.d.cts +19 -4
  228. package/build/modern/notifyManager.d.cts.map +1 -1
  229. package/build/modern/notifyManager.d.ts +19 -4
  230. package/build/modern/notifyManager.d.ts.map +1 -1
  231. package/build/modern/notifyManager.js +12 -2
  232. package/build/modern/notifyManager.js.map +1 -1
  233. package/build/modern/onlineManager.cjs +4 -2
  234. package/build/modern/onlineManager.cjs.map +1 -1
  235. package/build/modern/onlineManager.d.cts +5 -3
  236. package/build/modern/onlineManager.d.cts.map +1 -1
  237. package/build/modern/onlineManager.d.ts +5 -3
  238. package/build/modern/onlineManager.d.ts.map +1 -1
  239. package/build/modern/onlineManager.js +4 -2
  240. package/build/modern/onlineManager.js.map +1 -1
  241. package/build/modern/queriesObserver.cjs +15 -3
  242. package/build/modern/queriesObserver.cjs.map +1 -1
  243. package/build/modern/queriesObserver.d.cts +14 -5
  244. package/build/modern/queriesObserver.d.cts.map +1 -1
  245. package/build/modern/queriesObserver.d.ts +14 -5
  246. package/build/modern/queriesObserver.d.ts.map +1 -1
  247. package/build/modern/queriesObserver.js +15 -3
  248. package/build/modern/queriesObserver.js.map +1 -1
  249. package/build/modern/query.cjs +89 -15
  250. package/build/modern/query.cjs.map +1 -1
  251. package/build/modern/query.d.cts +1 -1
  252. package/build/modern/query.d.ts +1 -1
  253. package/build/modern/query.js +89 -15
  254. package/build/modern/query.js.map +1 -1
  255. package/build/modern/queryCache.cjs +34 -12
  256. package/build/modern/queryCache.cjs.map +1 -1
  257. package/build/modern/queryCache.d.cts +1 -1
  258. package/build/modern/queryCache.d.ts +1 -1
  259. package/build/modern/queryCache.js +34 -12
  260. package/build/modern/queryCache.js.map +1 -1
  261. package/build/modern/queryClient.cjs +104 -32
  262. package/build/modern/queryClient.cjs.map +1 -1
  263. package/build/modern/queryClient.d.cts +1 -1
  264. package/build/modern/queryClient.d.ts +1 -1
  265. package/build/modern/queryClient.js +104 -32
  266. package/build/modern/queryClient.js.map +1 -1
  267. package/build/modern/queryObserver.cjs +78 -6
  268. package/build/modern/queryObserver.cjs.map +1 -1
  269. package/build/modern/queryObserver.d.cts +1 -1
  270. package/build/modern/queryObserver.d.ts +1 -1
  271. package/build/modern/queryObserver.js +78 -6
  272. package/build/modern/queryObserver.js.map +1 -1
  273. package/build/modern/{removable-0GzhW1PK.d.ts → removable-Cw9GNGyK.d.cts} +17 -1
  274. package/build/modern/removable-Cw9GNGyK.d.cts.map +1 -0
  275. package/build/{legacy/removable-0GzhW1PK.d.ts → modern/removable-Cw9GNGyK.d.ts} +17 -1
  276. package/build/modern/removable-Cw9GNGyK.d.ts.map +1 -0
  277. package/build/modern/removable.cjs +12 -0
  278. package/build/modern/removable.cjs.map +1 -1
  279. package/build/modern/removable.d.cts +1 -1
  280. package/build/modern/removable.d.ts +1 -1
  281. package/build/modern/removable.js +12 -0
  282. package/build/modern/removable.js.map +1 -1
  283. package/build/modern/retryer.cjs +26 -4
  284. package/build/modern/retryer.cjs.map +1 -1
  285. package/build/modern/retryer.d.cts +1 -1
  286. package/build/modern/retryer.d.ts +1 -1
  287. package/build/modern/retryer.js +26 -4
  288. package/build/modern/retryer.js.map +1 -1
  289. package/build/modern/streamedQuery.cjs +3 -1
  290. package/build/modern/streamedQuery.cjs.map +1 -1
  291. package/build/modern/streamedQuery.d.cts +4 -2
  292. package/build/modern/streamedQuery.d.cts.map +1 -1
  293. package/build/modern/streamedQuery.d.ts +4 -2
  294. package/build/modern/streamedQuery.d.ts.map +1 -1
  295. package/build/modern/streamedQuery.js +3 -1
  296. package/build/modern/streamedQuery.js.map +1 -1
  297. package/build/modern/{subscribable-CysQ0tne.d.ts → subscribable-czlHOxMP.d.cts} +11 -1
  298. package/build/modern/subscribable-czlHOxMP.d.cts.map +1 -0
  299. package/build/{legacy/subscribable-CysQ0tne.d.ts → modern/subscribable-czlHOxMP.d.ts} +11 -1
  300. package/build/modern/subscribable-czlHOxMP.d.ts.map +1 -0
  301. package/build/modern/subscribable.cjs +10 -0
  302. package/build/modern/subscribable.cjs.map +1 -1
  303. package/build/modern/subscribable.d.cts +1 -1
  304. package/build/modern/subscribable.d.ts +1 -1
  305. package/build/modern/subscribable.js +10 -0
  306. package/build/modern/subscribable.js.map +1 -1
  307. package/build/modern/timeoutManager.cjs +11 -6
  308. package/build/modern/timeoutManager.cjs.map +1 -1
  309. package/build/modern/timeoutManager.d.cts +23 -6
  310. package/build/modern/timeoutManager.d.cts.map +1 -1
  311. package/build/modern/timeoutManager.d.ts +23 -6
  312. package/build/modern/timeoutManager.d.ts.map +1 -1
  313. package/build/modern/timeoutManager.js +11 -6
  314. package/build/modern/timeoutManager.js.map +1 -1
  315. package/build/modern/types.cjs.map +1 -1
  316. package/build/modern/types.d.cts +1 -1
  317. package/build/modern/types.d.ts +1 -1
  318. package/build/modern/types.js.map +1 -1
  319. package/build/modern/utils.cjs +117 -8
  320. package/build/modern/utils.cjs.map +1 -1
  321. package/build/modern/utils.d.cts +1 -1
  322. package/build/modern/utils.d.ts +1 -1
  323. package/build/modern/utils.js +117 -8
  324. package/build/modern/utils.js.map +1 -1
  325. package/package.json +3 -3
  326. package/src/environmentManager.ts +6 -1
  327. package/src/focusManager.ts +8 -6
  328. package/src/hydration.ts +42 -1
  329. package/src/infiniteQueryBehavior.ts +29 -0
  330. package/src/infiniteQueryObserver.ts +20 -14
  331. package/src/mutation.ts +32 -11
  332. package/src/mutationCache.ts +53 -12
  333. package/src/mutationObserver.ts +29 -14
  334. package/src/notifyManager.ts +12 -2
  335. package/src/onlineManager.ts +7 -5
  336. package/src/queriesObserver.ts +20 -5
  337. package/src/query.ts +153 -20
  338. package/src/queryCache.ts +54 -13
  339. package/src/queryClient.ts +114 -42
  340. package/src/queryObserver.ts +88 -12
  341. package/src/removable.ts +16 -0
  342. package/src/retryer.ts +57 -4
  343. package/src/streamedQuery.ts +4 -3
  344. package/src/subscribable.ts +10 -0
  345. package/src/timeoutManager.ts +23 -6
  346. package/src/types.ts +801 -27
  347. package/src/utils.ts +130 -10
  348. package/build/legacy/hydration-B9t5w6NC.d.ts.map +0 -1
  349. package/build/legacy/hydration-Br9VIGXa.d.cts.map +0 -1
  350. package/build/legacy/removable-0GzhW1PK.d.cts.map +0 -1
  351. package/build/legacy/removable-0GzhW1PK.d.ts.map +0 -1
  352. package/build/legacy/subscribable-CysQ0tne.d.cts.map +0 -1
  353. package/build/legacy/subscribable-CysQ0tne.d.ts.map +0 -1
  354. package/build/modern/hydration-B9t5w6NC.d.ts.map +0 -1
  355. package/build/modern/hydration-Br9VIGXa.d.cts.map +0 -1
  356. package/build/modern/removable-0GzhW1PK.d.cts.map +0 -1
  357. package/build/modern/removable-0GzhW1PK.d.ts.map +0 -1
  358. package/build/modern/subscribable-CysQ0tne.d.cts.map +0 -1
  359. package/build/modern/subscribable-CysQ0tne.d.ts.map +0 -1
@@ -62,7 +62,6 @@ interface MutationDefaults {
62
62
  * `QueryClient` is used to interact with a cache of queries and mutations. It owns a
63
63
  * `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds
64
64
  * the default options that are applied to queries and mutations created through it.
65
- *
66
65
  * @example
67
66
  * ```ts
68
67
  * const queryClient = new QueryClient({
@@ -139,7 +138,9 @@ export class QueryClient {
139
138
  * Returns the number of queries in the cache that are currently fetching, optionally
140
139
  * matching a set of filters. This includes background-fetching, loading new pages, and
141
140
  * loading more infinite query results.
142
- *
141
+ * @param filters - Narrows down which fetching queries are counted. Without filters, every
142
+ * fetching query is counted.
143
+ * @returns The number of matching queries whose `fetchStatus` is `'fetching'`.
143
144
  * @example
144
145
  * ```ts
145
146
  * if (queryClient.isFetching()) {
@@ -157,7 +158,9 @@ export class QueryClient {
157
158
  /**
158
159
  * Returns the number of mutations in the cache that are currently pending, optionally
159
160
  * matching a set of filters.
160
- *
161
+ * @param filters - Narrows down which pending mutations are counted. Without filters, every
162
+ * pending mutation is counted.
163
+ * @returns The number of matching mutations whose `status` is `'pending'`.
161
164
  * @example
162
165
  * ```ts
163
166
  * if (queryClient.isMutating()) {
@@ -177,7 +180,7 @@ export class QueryClient {
177
180
  *
178
181
  * Hint: Do not use this function inside a component, because it won't receive updates.
179
182
  * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
180
- *
183
+ * @param queryKey - The query key of the query to read.
181
184
  * @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.
182
185
  * @see {@link QueryClient#getQueriesData}
183
186
  */
@@ -193,6 +196,12 @@ export class QueryClient {
193
196
  }
194
197
 
195
198
  /**
199
+ * Returns the cached data of a query, or fetches it if there is none. With `revalidateIfStale`,
200
+ * stale cached data is also refetched in the background.
201
+ * @param options - The query options. If the query has no cached data yet, it is fetched with
202
+ * these options.
203
+ * @returns A promise that resolves to the cached data, or to the fetched data if nothing was
204
+ * cached yet.
196
205
  * @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
197
206
  */
198
207
  ensureQueryData<
@@ -208,7 +217,7 @@ export class QueryClient {
208
217
  const cachedData = query.state.data
209
218
 
210
219
  if (cachedData === undefined) {
211
- // eslint-disable-next-line no-restricted-syntax
220
+ // oxlint-disable-next-line tanstack-query/no-restricted-syntax
212
221
  return this.fetchQuery(options)
213
222
  }
214
223
 
@@ -216,7 +225,7 @@ export class QueryClient {
216
225
  options.revalidateIfStale &&
217
226
  query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query))
218
227
  ) {
219
- // eslint-disable-next-line no-restricted-syntax
228
+ // oxlint-disable-next-line tanstack-query/no-restricted-syntax
220
229
  void this.prefetchQuery(defaultedOptions)
221
230
  }
222
231
 
@@ -233,7 +242,7 @@ export class QueryClient {
233
242
  * than being inferred. Passing a more specific type is a convenience for call sites that know
234
243
  * every matched query holds the same shape — it is not checked against the actual cache
235
244
  * contents.
236
- *
245
+ * @param filters - The filters that select which queries to read.
237
246
  * @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.
238
247
  * @see {@link QueryClient#getQueryData}
239
248
  * @example
@@ -259,14 +268,12 @@ export class QueryClient {
259
268
  *
260
269
  * Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved
261
270
  * via {@link QueryClient#getQueryData}, in place.
262
- *
263
271
  * @param queryKey - The query key to set data for.
264
272
  * @param updater - Either the new data, or a function that receives the current data (which
265
273
  * may be `undefined`) and returns the new data.
266
274
  * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.
267
275
  * @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case
268
276
  * the write is skipped and the cache is left unchanged.
269
- *
270
277
  * @example
271
278
  * ```ts
272
279
  * queryClient.setQueryData(['posts'], newPosts)
@@ -282,7 +289,7 @@ export class QueryClient {
282
289
  >(
283
290
  queryKey: TTaggedQueryKey,
284
291
  updater: Updater<
285
- NoInfer<TInferredQueryFnData> | undefined,
292
+ InferDataFromTag<NoInfer<TQueryFnData>, TTaggedQueryKey> | undefined,
286
293
  NoInfer<TInferredQueryFnData> | undefined
287
294
  >,
288
295
  options?: SetDataOptions,
@@ -295,9 +302,9 @@ export class QueryClient {
295
302
  QueryKey
296
303
  >({ queryKey })
297
304
 
298
- const query = this.#queryCache.get<TInferredQueryFnData>(
299
- defaultedOptions.queryHash,
300
- )
305
+ const query = this.#queryCache.get<
306
+ InferDataFromTag<NoInfer<TQueryFnData>, TTaggedQueryKey>
307
+ >(defaultedOptions.queryHash)
301
308
  const prevData = query?.state.data
302
309
  const data = functionalUpdate(updater, prevData)
303
310
 
@@ -315,7 +322,10 @@ export class QueryClient {
315
322
  * filters or partial query key matching. Only queries that already exist and match the given
316
323
  * filters are updated; no new cache entries are created. Internally this calls
317
324
  * {@link QueryClient#setQueryData} for each matching query.
318
- *
325
+ * @param filters - The filters that select which existing queries to update.
326
+ * @param updater - Either the new data, or a function that receives each matched query's current
327
+ * data (which may be `undefined`) and returns the new data.
328
+ * @param options - Set `updatedAt` to override the timestamp the written data is recorded with.
319
329
  * @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same
320
330
  * `undefined` case as {@link QueryClient#setQueryData}.
321
331
  * @example
@@ -349,7 +359,8 @@ export class QueryClient {
349
359
  /**
350
360
  * Imperative (non-reactive) way to retrieve an existing query's state. If the query does not
351
361
  * exist, `undefined` is returned.
352
- *
362
+ * @param queryKey - The query key of the query to read.
363
+ * @returns The query's state, or `undefined` if no query with this key exists.
353
364
  * @example
354
365
  * ```ts
355
366
  * const state = queryClient.getQueryState(['posts'])
@@ -376,7 +387,8 @@ export class QueryClient {
376
387
  * {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes
377
388
  * matching queries from the cache instead of refetching them. Without filters, every query in
378
389
  * the cache is removed.
379
- *
390
+ * @param filters - The filters that select which queries to remove. Without filters, every query
391
+ * is removed.
380
392
  * @example
381
393
  * ```ts
382
394
  * queryClient.removeQueries({ queryKey: ['posts'], exact: true })
@@ -397,7 +409,11 @@ export class QueryClient {
397
409
  * Resets queries matching the given filters back to their initial state (e.g. any
398
410
  * `initialData`), notifying subscribers rather than removing them. Active queries among the
399
411
  * matched set are then refetched, and the returned promise resolves once that refetch settles.
400
- *
412
+ * @param filters - The filters that select which queries to reset. Without filters, every query
413
+ * is reset.
414
+ * @param options - Passed to the refetch of the active matched queries, e.g. `cancelRefetch` and
415
+ * `throwOnError`.
416
+ * @returns A promise that resolves once the refetch of the active matched queries settles.
401
417
  * @example
402
418
  * ```ts
403
419
  * await queryClient.resetQueries({ queryKey: ['posts'], exact: true })
@@ -432,7 +448,11 @@ export class QueryClient {
432
448
  * reverted to its state before the outgoing fetch started.
433
449
  *
434
450
  * The returned promise never rejects, even if individual cancellations fail.
435
- *
451
+ * @param filters - The filters that select which queries to cancel. Without filters, every query
452
+ * is cancelled.
453
+ * @param cancelOptions - Passed to each matched query's cancellation. `revert` defaults to
454
+ * `true`.
455
+ * @returns A promise that resolves once every cancellation has settled.
436
456
  * @example
437
457
  * ```ts
438
458
  * await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })
@@ -460,7 +480,12 @@ export class QueryClient {
460
480
  * Unless `filters.refetchType` is `'none'`, matching queries are then refetched via
461
481
  * {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise
462
482
  * `filters.type`, otherwise `'active'`.
463
- *
483
+ * @param filters - The filters that select which queries to invalidate, plus `refetchType` to
484
+ * control which of them to refetch afterwards. Without filters, every query is invalidated.
485
+ * @param options - Passed to {@link QueryClient#refetchQueries}, e.g. `cancelRefetch` and
486
+ * `throwOnError`.
487
+ * @returns A promise that resolves once the refetch settles, or immediately if `refetchType` is
488
+ * `'none'`.
464
489
  * @example
465
490
  * ```ts
466
491
  * await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })
@@ -496,7 +521,11 @@ export class QueryClient {
496
521
  * By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new
497
522
  * one starts. The returned promise resolves once all matching queries have settled; it does
498
523
  * not reject on individual query failures unless `throwOnError` is set.
499
- *
524
+ * @param filters - The filters that select which queries to refetch. Without filters, every query
525
+ * in the cache is included.
526
+ * @param options - Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling
527
+ * it, and `throwOnError` to `true` to reject when a refetch fails.
528
+ * @returns A promise that resolves once every matched query has settled.
500
529
  * @example
501
530
  * ```ts
502
531
  * // refetch all active queries partially matching a query key:
@@ -550,7 +579,10 @@ export class QueryClient {
550
579
  *
551
580
  * This method replaces the deprecated `fetchQuery`, and — combined with
552
581
  * `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.
553
- *
582
+ * @param options - The query options, including the `queryKey` and the `queryFn` used if the
583
+ * query needs to fetch.
584
+ * @returns A promise that resolves to the data, or to the result of `select` if provided. It
585
+ * rejects with the error from the fetch or from `select`.
554
586
  * @example
555
587
  * ```ts
556
588
  * try {
@@ -604,6 +636,12 @@ export class QueryClient {
604
636
  }
605
637
 
606
638
  /**
639
+ * Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers,
640
+ * the fetch isn't retried unless `retry` is set.
641
+ * @param options - The query options, including the `queryKey` and the `queryFn` used if the
642
+ * query needs to fetch.
643
+ * @returns A promise that resolves to the cached or fetched data, or rejects with the fetch
644
+ * error.
607
645
  * @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.
608
646
  */
609
647
  fetchQuery<
@@ -638,6 +676,11 @@ export class QueryClient {
638
676
  }
639
677
 
640
678
  /**
679
+ * Fetches and caches a query like {@link QueryClient#fetchQuery}, but ignores the result and any
680
+ * error.
681
+ * @param options - The query options, including the `queryKey` and the `queryFn` used if the
682
+ * query needs to fetch.
683
+ * @returns A promise that resolves once the fetch settles. It never rejects.
641
684
  * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
642
685
  */
643
686
  prefetchQuery<
@@ -648,7 +691,7 @@ export class QueryClient {
648
691
  >(
649
692
  options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
650
693
  ): Promise<void> {
651
- // eslint-disable-next-line no-restricted-syntax
694
+ // oxlint-disable-next-line tanstack-query/no-restricted-syntax
652
695
  return this.fetchQuery(options).then(noop).catch(noop)
653
696
  }
654
697
 
@@ -662,7 +705,10 @@ export class QueryClient {
662
705
  *
663
706
  * This method replaces the deprecated `fetchInfiniteQuery`, and — combined with
664
707
  * `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.
665
- *
708
+ * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the
709
+ * `initialPageParam`.
710
+ * @returns A promise that resolves to the {@link InfiniteData}, or to the result of `select` if
711
+ * provided. It rejects with the error from the fetch or from `select`.
666
712
  * @example
667
713
  * ```ts
668
714
  * try {
@@ -697,6 +743,11 @@ export class QueryClient {
697
743
  }
698
744
 
699
745
  /**
746
+ * Fetches and caches an infinite query, or returns its cached data if it isn't stale.
747
+ * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the
748
+ * `initialPageParam`.
749
+ * @returns A promise that resolves to the cached or fetched {@link InfiniteData}, or rejects with
750
+ * the fetch error.
700
751
  * @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.
701
752
  */
702
753
  fetchInfiniteQuery<
@@ -715,11 +766,16 @@ export class QueryClient {
715
766
  >,
716
767
  ): Promise<InfiniteData<TData, TPageParam>> {
717
768
  options._type = 'infinite'
718
- // eslint-disable-next-line no-restricted-syntax
769
+ // oxlint-disable-next-line tanstack-query/no-restricted-syntax
719
770
  return this.fetchQuery(options as any)
720
771
  }
721
772
 
722
773
  /**
774
+ * Fetches and caches an infinite query like {@link QueryClient#fetchInfiniteQuery}, but ignores
775
+ * the result and any error.
776
+ * @param options - The infinite query options, including the `queryKey`, the `queryFn`, and the
777
+ * `initialPageParam`.
778
+ * @returns A promise that resolves once the fetch settles. It never rejects.
723
779
  * @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
724
780
  */
725
781
  prefetchInfiniteQuery<
@@ -737,11 +793,17 @@ export class QueryClient {
737
793
  TPageParam
738
794
  >,
739
795
  ): Promise<void> {
740
- // eslint-disable-next-line no-restricted-syntax
796
+ // oxlint-disable-next-line tanstack-query/no-restricted-syntax
741
797
  return this.fetchInfiniteQuery(options).then(noop).catch(noop)
742
798
  }
743
799
 
744
800
  /**
801
+ * Returns the cached data of an infinite query, or fetches it if there is none. With
802
+ * `revalidateIfStale`, stale cached data is also refetched in the background.
803
+ * @param options - The infinite query options. If the query has no cached data yet, it is fetched
804
+ * with these options.
805
+ * @returns A promise that resolves to the cached {@link InfiniteData}, or to the fetched data if
806
+ * nothing was cached yet.
745
807
  * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
746
808
  */
747
809
  ensureInfiniteQueryData<
@@ -761,14 +823,14 @@ export class QueryClient {
761
823
  ): Promise<InfiniteData<TData, TPageParam>> {
762
824
  options._type = 'infinite'
763
825
 
764
- // eslint-disable-next-line no-restricted-syntax
826
+ // oxlint-disable-next-line tanstack-query/no-restricted-syntax
765
827
  return this.ensureQueryData(options as any)
766
828
  }
767
829
 
768
830
  /**
769
831
  * Resumes mutations that were paused because there was no network connection. Does nothing
770
832
  * (resolving immediately) if the client is currently offline.
771
- *
833
+ * @returns A promise that resolves once the resumed mutations have settled.
772
834
  * @example
773
835
  * ```ts
774
836
  * import { QueryClient } from '@tanstack/query-core'
@@ -786,7 +848,7 @@ export class QueryClient {
786
848
 
787
849
  /**
788
850
  * Returns the query cache this client is connected to.
789
- *
851
+ * @returns The {@link QueryCache} instance.
790
852
  * @example
791
853
  * ```ts
792
854
  * import { QueryClient } from '@tanstack/query-core'
@@ -802,7 +864,7 @@ export class QueryClient {
802
864
 
803
865
  /**
804
866
  * Returns the mutation cache this client is connected to.
805
- *
867
+ * @returns The {@link MutationCache} instance.
806
868
  * @example
807
869
  * ```ts
808
870
  * import { QueryClient } from '@tanstack/query-core'
@@ -819,7 +881,7 @@ export class QueryClient {
819
881
  /**
820
882
  * Returns the default options that were set when creating the client, or via
821
883
  * {@link QueryClient#setDefaultOptions}.
822
- *
884
+ * @returns The client's current default options.
823
885
  * @example
824
886
  * ```ts
825
887
  * import { QueryClient } from '@tanstack/query-core'
@@ -835,7 +897,7 @@ export class QueryClient {
835
897
  /**
836
898
  * Dynamically sets the default options for this client, overwriting any previously defined
837
899
  * default options.
838
- *
900
+ * @param options - The new default options for queries and mutations.
839
901
  * @see {@link QueryClient#getDefaultOptions}
840
902
  * @example
841
903
  * ```ts
@@ -860,7 +922,8 @@ export class QueryClient {
860
922
  * registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the
861
923
  * most generic key to the least generic one — more specific defaults should be registered
862
924
  * after more generic ones so they take precedence.
863
- *
925
+ * @param queryKey - The query key that query keys are partially matched against.
926
+ * @param options - The default options applied to matching queries.
864
927
  * @example
865
928
  * ```ts
866
929
  * queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })
@@ -892,7 +955,9 @@ export class QueryClient {
892
955
  * Returns the default options registered for queries whose query key partially matches the
893
956
  * given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults
894
957
  * match, they are merged together in registration order.
895
- *
958
+ * @param queryKey - The query key to look up registered defaults for.
959
+ * @returns The merged default options of every registration that matches, or an empty object if
960
+ * none match.
896
961
  * @example
897
962
  * ```ts
898
963
  * const defaultOptions = queryClient.getQueryDefaults(['posts'])
@@ -920,7 +985,8 @@ export class QueryClient {
920
985
  * Sets default options for mutations whose mutation key partially matches the given
921
986
  * `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration
922
987
  * matters when several registered defaults match the same mutation key.
923
- *
988
+ * @param mutationKey - The mutation key that mutation keys are partially matched against.
989
+ * @param options - The default options applied to matching mutations.
924
990
  * @see {@link QueryClient#getMutationDefaults}
925
991
  * @example
926
992
  * ```ts
@@ -949,7 +1015,9 @@ export class QueryClient {
949
1015
  * Returns the default options registered for mutations whose mutation key partially matches
950
1016
  * the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered
951
1017
  * defaults match, they are merged together in registration order.
952
- *
1018
+ * @param mutationKey - The mutation key to look up registered defaults for.
1019
+ * @returns The merged default options of every registration that matches, or an empty object if
1020
+ * none match.
953
1021
  * @example
954
1022
  * ```ts
955
1023
  * const defaultOptions = queryClient.getMutationDefaults(['addPost'])
@@ -976,9 +1044,12 @@ export class QueryClient {
976
1044
 
977
1045
  /**
978
1046
  * Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the
979
- * caller into their final, defaulted form: merging `queryClient.setQueryDefaults` for the
980
- * given `queryKey`, then the client's own `defaultOptions.queries`, then the caller's options
981
- * on top. A no-op if the options are already defaulted (`_defaulted: true`).
1047
+ * caller into their final, defaulted form: merging the client's own `defaultOptions.queries`,
1048
+ * then `queryClient.setQueryDefaults` for the given `queryKey`, then the caller's options on
1049
+ * top. A no-op if the options are already defaulted (`_defaulted: true`).
1050
+ * @param options - The query options passed by the caller.
1051
+ * @returns The defaulted options, with `queryHash` and dependent defaults (e.g.
1052
+ * `refetchOnReconnect`) filled in.
982
1053
  */
983
1054
  defaultQueryOptions<
984
1055
  TQueryFnData = unknown,
@@ -1063,9 +1134,11 @@ export class QueryClient {
1063
1134
 
1064
1135
  /**
1065
1136
  * The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework
1066
- * adapters (e.g. inside `useMutation`) to merge `queryClient.setMutationDefaults` for the
1067
- * given `mutationKey`, then the client's `defaultOptions.mutations`, then the caller's options
1068
- * on top. A no-op if the options are already defaulted (`_defaulted: true`).
1137
+ * adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then
1138
+ * `queryClient.setMutationDefaults` for the given `mutationKey`, then the caller's options on
1139
+ * top. A no-op if the options are already defaulted (`_defaulted: true`).
1140
+ * @param options - The mutation options passed by the caller.
1141
+ * @returns The defaulted options.
1069
1142
  */
1070
1143
  defaultMutationOptions<T extends MutationOptions<any, any, any, any>>(
1071
1144
  options?: T,
@@ -1084,7 +1157,6 @@ export class QueryClient {
1084
1157
 
1085
1158
  /**
1086
1159
  * Clears both the query cache and the mutation cache this client is connected to.
1087
- *
1088
1160
  * @example
1089
1161
  * ```ts
1090
1162
  * import { QueryClient } from '@tanstack/query-core'