@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
package/src/hydration.ts CHANGED
@@ -16,6 +16,13 @@ import type { Mutation, MutationState } from './mutation'
16
16
  // TYPES
17
17
  type TransformerFn = (data: any) => any
18
18
 
19
+ /**
20
+ * Reads the value of a promise synchronously if it has already resolved, e.g. a thenable that
21
+ * resolves within its `then` call.
22
+ * @param promise - The promise to read.
23
+ * @returns An object with the resolved `data`, or `undefined` if the promise hasn't resolved
24
+ * synchronously (or resolved with `undefined`).
25
+ */
19
26
  function tryResolveSync(promise: PromiseLike<unknown>) {
20
27
  let data: unknown
21
28
 
@@ -25,7 +32,7 @@ function tryResolveSync(promise: PromiseLike<unknown>) {
25
32
  }, noop) as Promise<unknown> | undefined
26
33
 
27
34
  // .catch can be unavailable on certain kinds of thenable's
28
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
35
+ // oxlint-disable-next-line typescript/no-unnecessary-condition
29
36
  thenResult?.catch?.(noop)
30
37
 
31
38
  if (data !== undefined) {
@@ -93,12 +100,23 @@ interface DehydratedQuery {
93
100
  * that has already been fetched, avoiding a redundant fetch on the client.
94
101
  */
95
102
  export interface DehydratedState {
103
+ /**
104
+ * The dehydrated mutations, by default only the paused ones.
105
+ */
96
106
  mutations: Array<DehydratedMutation>
107
+ /**
108
+ * The dehydrated queries, by default only the successful ones.
109
+ */
97
110
  queries: Array<DehydratedQuery>
98
111
  }
99
112
 
100
113
  // FUNCTIONS
101
114
 
115
+ /**
116
+ * Dehydrates a single `Mutation` into a serializable snapshot of its key, state, scope, and meta.
117
+ * @param mutation - The mutation to dehydrate.
118
+ * @returns The dehydrated mutation.
119
+ */
102
120
  function dehydrateMutation(mutation: Mutation): DehydratedMutation {
103
121
  return {
104
122
  mutationKey: mutation.options.mutationKey,
@@ -108,6 +126,16 @@ function dehydrateMutation(mutation: Mutation): DehydratedMutation {
108
126
  }
109
127
  }
110
128
 
129
+ /**
130
+ * Prepares the in-flight promise of a pending query for dehydration: applies `serializeData` to its
131
+ * result, and redacts its rejection error unless `shouldRedactErrors` returns `false` for it.
132
+ * @param query - The pending query whose promise is dehydrated.
133
+ * @param serializeData - Optional transform applied to the resolved data.
134
+ * @param shouldRedactErrors - Optional predicate; if it returns `false` for the rejection error,
135
+ * that
136
+ * error is kept as-is instead of being redacted.
137
+ * @returns The transformed promise, or `undefined` if the query has no in-flight promise.
138
+ */
111
139
  function dehydratePromise(
112
140
  query: Query,
113
141
  serializeData?: TransformerFn,
@@ -145,6 +173,7 @@ function dehydratePromise(
145
173
  * @param serializeData - Optional transform applied to `query.state.data` before it is included in the snapshot.
146
174
  * @param shouldRedactErrors - Optional predicate; if it returns `false` for the promise's rejection error, that
147
175
  * error is kept as-is instead of being redacted.
176
+ * @returns The dehydrated query.
148
177
  */
149
178
  export function dehydrateQuery(
150
179
  query: Query,
@@ -174,6 +203,8 @@ export function dehydrateQuery(
174
203
  /**
175
204
  * The default `shouldDehydrateMutation` predicate used by `dehydrate`. Only dehydrates mutations that are
176
205
  * currently paused (e.g. paused by `networkMode` while offline).
206
+ * @param mutation - The mutation to check.
207
+ * @returns `true` if the mutation is paused.
177
208
  */
178
209
  export function defaultShouldDehydrateMutation(mutation: Mutation) {
179
210
  return mutation.state.isPaused
@@ -182,6 +213,8 @@ export function defaultShouldDehydrateMutation(mutation: Mutation) {
182
213
  /**
183
214
  * The default `shouldDehydrateQuery` predicate used by `dehydrate`. Only dehydrates queries whose status is
184
215
  * `'success'`.
216
+ * @param query - The query to check.
217
+ * @returns `true` if the query's status is `'success'`.
185
218
  */
186
219
  export function defaultShouldDehydrateQuery(query: Query) {
187
220
  return query.state.status === 'success'
@@ -193,6 +226,10 @@ export function defaultShouldDehydrateQuery(query: Query) {
193
226
  * Which queries/mutations are included, and how their data/errors are transformed, is controlled by `options`,
194
227
  * falling back to the client's `dehydrate` default options, and finally to `defaultShouldDehydrateQuery` /
195
228
  * `defaultShouldDehydrateMutation`.
229
+ * @param client - The client whose cache is dehydrated.
230
+ * @param options - Controls which queries and mutations are included and how their data and errors
231
+ * are transformed. Each option falls back to the client's `defaultOptions.dehydrate`.
232
+ * @returns The dehydrated state, with the included `queries` and `mutations`.
196
233
  * @example
197
234
  * ```ts
198
235
  * const queryClient = new QueryClient()
@@ -253,6 +290,10 @@ export function dehydrate(
253
290
  * to `'idle'` so they don't hydrate stuck in a fetching state. If a dehydrated query still had an in-flight
254
291
  * promise, it is resumed via `query.fetch()` (reusing that promise as `initialPromise`) rather than re-invoking
255
292
  * `queryFn`.
293
+ * @param client - The client whose cache is restored into.
294
+ * @param dehydratedState - The dehydrated state, e.g. produced by `dehydrate` on the server.
295
+ * @param options - `defaultOptions` merged into every restored query and mutation (on top of the
296
+ * client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeData`.
256
297
  * @example
257
298
  * ```ts
258
299
  * // dehydratedState was produced by `dehydrate` on the server
@@ -13,6 +13,14 @@ import type {
13
13
  QueryKey,
14
14
  } from './types'
15
15
 
16
+ /**
17
+ * Creates the behavior that fetches the pages of an infinite query: the next or previous page for
18
+ * `fetchNextPage`/`fetchPreviousPage`, or all pages again from the start on a refetch.
19
+ * @param pages - The number of pages to fetch from the start when all pages are fetched again,
20
+ * e.g. from the `pages` option of `queryClient.infiniteQuery`. Defaults to the number of cached
21
+ * pages.
22
+ * @returns The query behavior to set on an infinite query.
23
+ */
16
24
  export function infiniteQueryBehavior<TQueryFnData, TError, TData, TPageParam>(
17
25
  pages?: number,
18
26
  ): QueryBehavior<TQueryFnData, TError, InfiniteData<TData, TPageParam>> {
@@ -129,6 +137,12 @@ export function infiniteQueryBehavior<TQueryFnData, TError, TData, TPageParam>(
129
137
  }
130
138
  }
131
139
 
140
+ /**
141
+ * Computes the page param of the page after the last one, with the `getNextPageParam` option.
142
+ * @param options - The infinite query options.
143
+ * @param data - The current pages and page params.
144
+ * @returns The next page param, or `undefined` if there are no pages yet.
145
+ */
132
146
  function getNextPageParam(
133
147
  options: InfiniteQueryPageParamsOptions<any>,
134
148
  { pages, pageParams }: InfiniteData<unknown>,
@@ -144,6 +158,14 @@ function getNextPageParam(
144
158
  : undefined
145
159
  }
146
160
 
161
+ /**
162
+ * Computes the page param of the page before the first one, with the `getPreviousPageParam`
163
+ * option.
164
+ * @param options - The infinite query options.
165
+ * @param data - The current pages and page params.
166
+ * @returns The previous page param, or `undefined` if there are no pages yet or no
167
+ * `getPreviousPageParam` option.
168
+ */
147
169
  function getPreviousPageParam(
148
170
  options: InfiniteQueryPageParamsOptions<any>,
149
171
  { pages, pageParams }: InfiniteData<unknown>,
@@ -155,6 +177,9 @@ function getPreviousPageParam(
155
177
 
156
178
  /**
157
179
  * Checks if there is a next page.
180
+ * @param options - The infinite query options with `getNextPageParam`.
181
+ * @param data - The current pages and page params.
182
+ * @returns `true` if `getNextPageParam` returns a value other than `null` or `undefined`.
158
183
  */
159
184
  export function hasNextPage(
160
185
  options: InfiniteQueryPageParamsOptions<any, any>,
@@ -166,6 +191,10 @@ export function hasNextPage(
166
191
 
167
192
  /**
168
193
  * Checks if there is a previous page.
194
+ * @param options - The infinite query options with `getPreviousPageParam`.
195
+ * @param data - The current pages and page params.
196
+ * @returns `true` if `getPreviousPageParam` is set and returns a value other than `null` or
197
+ * `undefined`.
169
198
  */
170
199
  export function hasPreviousPage(
171
200
  options: InfiniteQueryPageParamsOptions<any, any>,
@@ -25,7 +25,6 @@ type InfiniteQueryObserverListener<TData, TError> = (
25
25
  * infinite-query-specific fields and methods, such as `hasNextPage` and
26
26
  * `fetchNextPage`, and is the primitive that framework adapters (e.g.
27
27
  * `useInfiniteQuery`) build their hooks on top of.
28
- *
29
28
  * @example
30
29
  * ```ts
31
30
  * const observer = new InfiniteQueryObserver(queryClient, {
@@ -52,12 +51,12 @@ export class InfiniteQueryObserver<
52
51
  TQueryKey
53
52
  > {
54
53
  // Type override
55
- subscribe!: Subscribable<
54
+ override subscribe!: Subscribable<
56
55
  InfiniteQueryObserverListener<TData, TError>
57
56
  >['subscribe']
58
57
 
59
58
  // Type override
60
- getCurrentResult!: ReplaceReturnType<
59
+ override getCurrentResult!: ReplaceReturnType<
61
60
  QueryObserver<
62
61
  TQueryFnData,
63
62
  TError,
@@ -69,7 +68,7 @@ export class InfiniteQueryObserver<
69
68
  >
70
69
 
71
70
  // Type override
72
- protected fetch!: ReplaceReturnType<
71
+ protected override fetch!: ReplaceReturnType<
73
72
  QueryObserver<
74
73
  TQueryFnData,
75
74
  TError,
@@ -93,7 +92,7 @@ export class InfiniteQueryObserver<
93
92
  super(client, options)
94
93
  }
95
94
 
96
- protected bindMethods(): void {
95
+ protected override bindMethods(): void {
97
96
  super.bindMethods()
98
97
  this.fetchNextPage = this.fetchNextPage.bind(this)
99
98
  this.fetchPreviousPage = this.fetchPreviousPage.bind(this)
@@ -104,8 +103,9 @@ export class InfiniteQueryObserver<
104
103
  * `QueryObserver.setOptions`, additionally marking the options as
105
104
  * belonging to an infinite query before delegating to the base
106
105
  * implementation.
106
+ * @param options - The new infinite query observer options.
107
107
  */
108
- setOptions(
108
+ override setOptions(
109
109
  options: InfiniteQueryObserverOptions<
110
110
  TQueryFnData,
111
111
  TError,
@@ -123,8 +123,10 @@ export class InfiniteQueryObserver<
123
123
  * options as an infinite query before delegating to it. Called by framework adapters (e.g.
124
124
  * `useInfiniteQuery`) ahead of subscribing, to compute the current `InfiniteQueryObserverResult`
125
125
  * synchronously.
126
+ * @param options - The defaulted infinite query observer options to compute the result for.
127
+ * @returns The result for the given options.
126
128
  */
127
- getOptimisticResult(
129
+ override getOptimisticResult(
128
130
  options: DefaultedInfiniteQueryObserverOptions<
129
131
  TQueryFnData,
130
132
  TError,
@@ -146,7 +148,11 @@ export class InfiniteQueryObserver<
146
148
  * param used for the fetch is determined by `getNextPageParam`, which
147
149
  * receives the current pages/page params and whose result also determines
148
150
  * `hasNextPage`.
149
- *
151
+ * @param options - Set `cancelRefetch` to `false` to ignore the call while a fetch is running,
152
+ * and `throwOnError` to `true` to reject when the fetch fails.
153
+ * @returns A promise that resolves with the result after the next page is fetched. With
154
+ * `cancelRefetch: false`, a running fetch is reused instead, so the next page may not be fetched.
155
+ * @see {@link InfiniteQueryObserver#fetchPreviousPage}
150
156
  * @example
151
157
  * ```ts
152
158
  * const { hasNextPage } = observer.getCurrentResult()
@@ -155,8 +161,6 @@ export class InfiniteQueryObserver<
155
161
  * await observer.fetchNextPage()
156
162
  * }
157
163
  * ```
158
- *
159
- * @see {@link InfiniteQueryObserver#fetchPreviousPage}
160
164
  */
161
165
  fetchNextPage(
162
166
  options?: FetchNextPageOptions,
@@ -175,7 +179,11 @@ export class InfiniteQueryObserver<
175
179
  * param used for the fetch is determined by `getPreviousPageParam`, which
176
180
  * receives the current pages/page params and whose result also determines
177
181
  * `hasPreviousPage`.
178
- *
182
+ * @param options - Set `cancelRefetch` to `false` to ignore the call while a fetch is running,
183
+ * and `throwOnError` to `true` to reject when the fetch fails.
184
+ * @returns A promise that resolves with the result after the previous page is fetched. With
185
+ * `cancelRefetch: false`, a running fetch is reused instead, so the previous page may not be fetched.
186
+ * @see {@link InfiniteQueryObserver#fetchNextPage}
179
187
  * @example
180
188
  * ```ts
181
189
  * const { hasPreviousPage } = observer.getCurrentResult()
@@ -184,8 +192,6 @@ export class InfiniteQueryObserver<
184
192
  * await observer.fetchPreviousPage()
185
193
  * }
186
194
  * ```
187
- *
188
- * @see {@link InfiniteQueryObserver#fetchNextPage}
189
195
  */
190
196
  fetchPreviousPage(
191
197
  options?: FetchPreviousPageOptions,
@@ -198,7 +204,7 @@ export class InfiniteQueryObserver<
198
204
  })
199
205
  }
200
206
 
201
- protected createResult(
207
+ protected override createResult(
202
208
  query: Query<
203
209
  TQueryFnData,
204
210
  TError,
package/src/mutation.ts CHANGED
@@ -105,6 +105,10 @@ interface ContinueAction {
105
105
  type: 'continue'
106
106
  }
107
107
 
108
+ /**
109
+ * The actions a mutation dispatches to update its state, e.g. when it starts, fails, pauses, or
110
+ * succeeds.
111
+ */
108
112
  export type Action<TData, TError, TVariables, TOnMutateResult> =
109
113
  | ContinueAction
110
114
  | ErrorAction<TError>
@@ -124,7 +128,6 @@ export type Action<TData, TError, TVariables, TOnMutateResult> =
124
128
  * code typically interacts with mutations indirectly through `QueryClient` or
125
129
  * a framework hook like `useMutation`. Direct access to a `Mutation` instance
126
130
  * is possible via `mutationCache.find()`/`getAll()` for inspecting cache state.
127
- *
128
131
  * @example
129
132
  * ```ts
130
133
  * const mutationCache = queryClient.getMutationCache()
@@ -164,7 +167,11 @@ export class Mutation<
164
167
  this.scheduleGc()
165
168
  }
166
169
 
167
- /** @internal */
170
+ /**
171
+ * Replaces the mutation's options and applies their `gcTime`.
172
+ * @internal
173
+ * @param options - The new mutation options.
174
+ */
168
175
  setOptions(
169
176
  options: MutationOptions<TData, TError, TVariables, TOnMutateResult>,
170
177
  ): void {
@@ -175,12 +182,18 @@ export class Mutation<
175
182
 
176
183
  /**
177
184
  * The `meta` object passed in the mutation's options, if any.
185
+ * @returns The mutation's `meta`, or `undefined` if none was set.
178
186
  */
179
187
  get meta(): MutationMeta | undefined {
180
188
  return this.options.meta
181
189
  }
182
190
 
183
- /** @internal */
191
+ /**
192
+ * Subscribes an observer to the mutation and stops its garbage collection.
193
+ * @internal
194
+ * @param observer - The observer to add. Adding an observer that is already subscribed does
195
+ * nothing.
196
+ */
184
197
  addObserver(observer: MutationObserver<any, any, any, any>): void {
185
198
  if (!this.#observers.includes(observer)) {
186
199
  this.#observers.push(observer)
@@ -196,7 +209,11 @@ export class Mutation<
196
209
  }
197
210
  }
198
211
 
199
- /** @internal */
212
+ /**
213
+ * Unsubscribes an observer from the mutation.
214
+ * @internal
215
+ * @param observer - The observer to remove. Garbage collection is scheduled afterwards.
216
+ */
200
217
  removeObserver(observer: MutationObserver<any, any, any, any>): void {
201
218
  this.#observers = this.#observers.filter((x) => x !== observer)
202
219
 
@@ -209,7 +226,7 @@ export class Mutation<
209
226
  })
210
227
  }
211
228
 
212
- protected optionalRemove() {
229
+ protected override optionalRemove() {
213
230
  if (!this.#observers.length) {
214
231
  if (this.state.status === 'pending') {
215
232
  this.scheduleGc()
@@ -230,15 +247,15 @@ export class Mutation<
230
247
  * this instance), `execute` is called again with the last known variables.
231
248
  * - Otherwise the mutation has already settled and this resolves immediately
232
249
  * without running anything again.
233
- *
250
+ * @returns A promise that settles with the resumed mutation: it rejects if the mutation fails.
251
+ * It resolves immediately if the mutation has already settled.
252
+ * @see {@link Mutation#execute}
234
253
  * @example
235
254
  * ```ts
236
255
  * // typically driven by reconnect handling, e.g. queryClient.resumePausedMutations()
237
256
  * const mutation = mutationCache.find({ mutationKey: ['addPost'] })
238
257
  * await mutation?.continue()
239
258
  * ```
240
- *
241
- * @see {@link Mutation#execute}
242
259
  */
243
260
  continue(): Promise<unknown> {
244
261
  return (
@@ -271,15 +288,15 @@ export class Mutation<
271
288
  * those four callbacks is individually caught so that a throwing callback
272
289
  * cannot mask the original error; an `error` action is then dispatched and
273
290
  * the original error is re-thrown.
274
- *
291
+ * @param variables - The variables passed to the `mutationFn`.
292
+ * @returns A promise that resolves with the mutation's data, or rejects with its error.
293
+ * @see {@link Mutation#continue}
275
294
  * @example
276
295
  * ```ts
277
296
  * // Called internally by `MutationObserver.mutate` and `Mutation.continue` —
278
297
  * // applications normally trigger mutations through those, not this method.
279
298
  * const data = await mutation.execute(variables)
280
299
  * ```
281
- *
282
- * @see {@link Mutation#continue}
283
300
  */
284
301
  async execute(variables: TVariables): Promise<TData> {
285
302
  const onContinue = () => {
@@ -515,6 +532,10 @@ export class Mutation<
515
532
  }
516
533
  }
517
534
 
535
+ /**
536
+ * Returns the initial state of a mutation: `'idle'`, with no data, error, or variables.
537
+ * @returns The initial mutation state.
538
+ */
518
539
  export function getDefaultState<
519
540
  TData,
520
541
  TError,
@@ -113,7 +113,6 @@ type MutationCacheListener = (event: MutationCacheNotifyEvent) => void
113
113
  * Normally, you will not interact with the `MutationCache` directly and instead use a
114
114
  * `QueryClient`. You can subscribe to it (inherited from `Subscribable`) to be informed of
115
115
  * safe/known updates to the cache, such as mutations being added, removed, or updated.
116
- *
117
116
  * @example
118
117
  * ```ts
119
118
  * const unsubscribe = mutationCache.subscribe((event) => {
@@ -133,7 +132,15 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
133
132
  this.#mutationId = 0
134
133
  }
135
134
 
136
- /** @internal */
135
+ /**
136
+ * Creates a mutation and adds it to the cache.
137
+ * @internal
138
+ * @param client - The client the mutation belongs to, used to default its options.
139
+ * @param options - The mutation options. They are defaulted with {@link
140
+ * QueryClient#defaultMutationOptions}.
141
+ * @param state - The initial state of the mutation, e.g. when restoring a dehydrated mutation.
142
+ * @returns The new mutation, already added to the cache.
143
+ */
137
144
  build<TData, TError, TVariables, TOnMutateResult>(
138
145
  client: QueryClient,
139
146
  options: MutationOptions<TData, TError, TVariables, TOnMutateResult>,
@@ -152,7 +159,11 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
152
159
  return mutation
153
160
  }
154
161
 
155
- /** @internal */
162
+ /**
163
+ * Adds a mutation to the cache.
164
+ * @internal
165
+ * @param mutation - The mutation to add. If it has a `scope`, it is queued in that scope.
166
+ */
156
167
  add(mutation: Mutation<any, any, any, any>): void {
157
168
  this.#mutations.add(mutation)
158
169
  const scope = scopeFor(mutation)
@@ -167,7 +178,11 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
167
178
  this.notify({ type: 'added', mutation })
168
179
  }
169
180
 
170
- /** @internal */
181
+ /**
182
+ * Removes a mutation from the cache.
183
+ * @internal
184
+ * @param mutation - The mutation to remove, also from its scope's queue.
185
+ */
171
186
  remove(mutation: Mutation<any, any, any, any>): void {
172
187
  if (this.#mutations.delete(mutation)) {
173
188
  const scope = scopeFor(mutation)
@@ -191,7 +206,13 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
191
206
  this.notify({ type: 'removed', mutation })
192
207
  }
193
208
 
194
- /** @internal */
209
+ /**
210
+ * Checks whether a mutation can run now, given the other mutations in its `scope`.
211
+ * @internal
212
+ * @param mutation - The mutation to check.
213
+ * @returns `true` if the mutation has no `scope`, or no other mutation in its scope is pending
214
+ * ahead of it.
215
+ */
195
216
  canRun(mutation: Mutation<any, any, any, any>): boolean {
196
217
  const scope = scopeFor(mutation)
197
218
  if (typeof scope === 'string') {
@@ -209,7 +230,13 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
209
230
  }
210
231
  }
211
232
 
212
- /** @internal */
233
+ /**
234
+ * Continues the next paused mutation in the same `scope` after a mutation finishes.
235
+ * @internal
236
+ * @param mutation - The mutation that finished.
237
+ * @returns A promise that resolves once the next paused mutation in the same scope has continued,
238
+ * or immediately if there is none.
239
+ */
213
240
  runNext(mutation: Mutation<any, any, any, any>): Promise<unknown> {
214
241
  const scope = scopeFor(mutation)
215
242
  if (typeof scope === 'string') {
@@ -225,7 +252,6 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
225
252
 
226
253
  /**
227
254
  * Removes all mutations from the cache.
228
- *
229
255
  * @example
230
256
  * ```ts
231
257
  * const mutationCache = queryClient.getMutationCache()
@@ -248,7 +274,7 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
248
274
  *
249
275
  * This is not typically needed for most applications, but can come in handy when needing more
250
276
  * information about a mutation in rare scenarios.
251
- *
277
+ * @returns Every mutation in the cache.
252
278
  * @example
253
279
  * ```ts
254
280
  * const mutationCache = queryClient.getMutationCache()
@@ -266,7 +292,8 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
266
292
  *
267
293
  * This is not typically needed for most applications, but can come in handy when needing more
268
294
  * information about a mutation in rare scenarios.
269
- *
295
+ * @param filters - The filters to match. `exact` defaults to `true`.
296
+ * @returns The first matching mutation, or `undefined`.
270
297
  * @see {@link MutationCache#findAll}
271
298
  * @example
272
299
  * ```ts
@@ -296,7 +323,8 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
296
323
  *
297
324
  * This is not typically needed for most applications, but can come in handy when needing more
298
325
  * information about mutations in rare scenarios.
299
- *
326
+ * @param filters - The filters to match. Without filters, every mutation is returned.
327
+ * @returns The matching mutations.
300
328
  * @see {@link MutationCache#find}
301
329
  * @example
302
330
  * ```ts
@@ -309,7 +337,11 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
309
337
  return this.getAll().filter((mutation) => matchMutation(filters, mutation))
310
338
  }
311
339
 
312
- /** @internal */
340
+ /**
341
+ * Notifies every cache listener of an event, in one batch.
342
+ * @internal
343
+ * @param event - The event passed to every listener.
344
+ */
313
345
  notify(event: MutationCacheNotifyEvent) {
314
346
  notifyManager.batch(() => {
315
347
  this.listeners.forEach((listener) => {
@@ -318,7 +350,11 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
318
350
  })
319
351
  }
320
352
 
321
- /** @internal */
353
+ /**
354
+ * Continues every paused mutation, e.g. when the app comes back online.
355
+ * @internal
356
+ * @returns A promise that resolves once every paused mutation has continued and settled.
357
+ */
322
358
  resumePausedMutations(): Promise<unknown> {
323
359
  const pausedMutations = this.getAll().filter((x) => x.state.isPaused)
324
360
 
@@ -330,6 +366,11 @@ export class MutationCache extends Subscribable<MutationCacheListener> {
330
366
  }
331
367
  }
332
368
 
369
+ /**
370
+ * Returns the scope id of a mutation, used to run mutations with the same scope one after another.
371
+ * @param mutation - The mutation to read the scope of.
372
+ * @returns The mutation's `scope.id`, or `undefined` if it has no scope.
373
+ */
333
374
  function scopeFor(mutation: Mutation<any, any, any, any>) {
334
375
  return mutation.options.scope?.id
335
376
  }