@suspensive/react-query-4 3.19.6 → 4.0.0-next.0

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 (290) hide show
  1. package/dist/ClientOnly-BSe1ROuK.cjs +20 -0
  2. package/dist/ClientOnly-BSe1ROuK.cjs.map +1 -0
  3. package/dist/ClientOnly-D2JpP9Ba.mjs +15 -0
  4. package/dist/ClientOnly-D2JpP9Ba.mjs.map +1 -0
  5. package/dist/IsFetching-BGIRMA6C.cjs +17 -0
  6. package/dist/IsFetching-BGIRMA6C.cjs.map +1 -0
  7. package/dist/IsFetching-CJrzs0ET.d.mts +16 -0
  8. package/dist/IsFetching-CJrzs0ET.d.mts.map +1 -0
  9. package/dist/IsFetching-Di9jXfRH.mjs +12 -0
  10. package/dist/IsFetching-Di9jXfRH.mjs.map +1 -0
  11. package/dist/IsFetching-FFvHWt5I.d.cts +16 -0
  12. package/dist/IsFetching-FFvHWt5I.d.cts.map +1 -0
  13. package/dist/IsFetching.cjs +2 -18
  14. package/dist/IsFetching.d.cts +2 -18
  15. package/dist/IsFetching.d.mts +2 -18
  16. package/dist/IsFetching.mjs +2 -17
  17. package/dist/Mutation-BWER242k.cjs +19 -0
  18. package/dist/Mutation-BWER242k.cjs.map +1 -0
  19. package/dist/Mutation-SB8NYSR4.mjs +14 -0
  20. package/dist/Mutation-SB8NYSR4.mjs.map +1 -0
  21. package/dist/Mutation-rhItOp02.d.cts +14 -0
  22. package/dist/Mutation-rhItOp02.d.cts.map +1 -0
  23. package/dist/Mutation-sfj_v5Fj.d.mts +14 -0
  24. package/dist/Mutation-sfj_v5Fj.d.mts.map +1 -0
  25. package/dist/Mutation.cjs +2 -14
  26. package/dist/Mutation.d.cts +2 -14
  27. package/dist/Mutation.d.mts +2 -14
  28. package/dist/Mutation.mjs +2 -13
  29. package/dist/PrefetchInfiniteQuery-BH6xERH5.mjs +20 -0
  30. package/dist/PrefetchInfiniteQuery-BH6xERH5.mjs.map +1 -0
  31. package/dist/PrefetchInfiniteQuery-Bf5JUe7U.cjs +25 -0
  32. package/dist/PrefetchInfiniteQuery-Bf5JUe7U.cjs.map +1 -0
  33. package/dist/PrefetchInfiniteQuery-CBl7Fblo.d.cts +17 -0
  34. package/dist/PrefetchInfiniteQuery-CBl7Fblo.d.cts.map +1 -0
  35. package/dist/PrefetchInfiniteQuery-CNNJphhx.d.mts +17 -0
  36. package/dist/PrefetchInfiniteQuery-CNNJphhx.d.mts.map +1 -0
  37. package/dist/PrefetchInfiniteQuery.cjs +2 -20
  38. package/dist/PrefetchInfiniteQuery.d.cts +2 -16
  39. package/dist/PrefetchInfiniteQuery.d.mts +2 -16
  40. package/dist/PrefetchInfiniteQuery.mjs +2 -19
  41. package/dist/PrefetchQuery-BmQt_WJk.d.mts +17 -0
  42. package/dist/PrefetchQuery-BmQt_WJk.d.mts.map +1 -0
  43. package/dist/PrefetchQuery-CqWzm0Tu.d.cts +17 -0
  44. package/dist/PrefetchQuery-CqWzm0Tu.d.cts.map +1 -0
  45. package/dist/PrefetchQuery-DQFTAE7M.mjs +20 -0
  46. package/dist/PrefetchQuery-DQFTAE7M.mjs.map +1 -0
  47. package/dist/PrefetchQuery-PBReP6tu.cjs +25 -0
  48. package/dist/PrefetchQuery-PBReP6tu.cjs.map +1 -0
  49. package/dist/PrefetchQuery.cjs +2 -20
  50. package/dist/PrefetchQuery.d.cts +2 -16
  51. package/dist/PrefetchQuery.d.mts +2 -16
  52. package/dist/PrefetchQuery.mjs +2 -19
  53. package/dist/QueriesHydration-B28Xmf0f.d.cts +106 -0
  54. package/dist/QueriesHydration-B28Xmf0f.d.cts.map +1 -0
  55. package/dist/QueriesHydration-CbLB0bKz.mjs +143 -0
  56. package/dist/QueriesHydration-CbLB0bKz.mjs.map +1 -0
  57. package/dist/QueriesHydration-Cd2lBXvZ.cjs +148 -0
  58. package/dist/QueriesHydration-Cd2lBXvZ.cjs.map +1 -0
  59. package/dist/QueriesHydration-D8Kdp7yq.d.mts +106 -0
  60. package/dist/QueriesHydration-D8Kdp7yq.d.mts.map +1 -0
  61. package/dist/QueriesHydration.cjs +2 -117
  62. package/dist/QueriesHydration.d.cts +2 -105
  63. package/dist/QueriesHydration.d.mts +2 -105
  64. package/dist/QueriesHydration.mjs +2 -116
  65. package/dist/QueryClientConsumer-B5vPlxA7.mjs +14 -0
  66. package/dist/QueryClientConsumer-B5vPlxA7.mjs.map +1 -0
  67. package/dist/QueryClientConsumer-COVqqi9y.d.cts +18 -0
  68. package/dist/QueryClientConsumer-COVqqi9y.d.cts.map +1 -0
  69. package/dist/QueryClientConsumer-CsNJXJGM.cjs +19 -0
  70. package/dist/QueryClientConsumer-CsNJXJGM.cjs.map +1 -0
  71. package/dist/QueryClientConsumer-YLHVJlTq.d.mts +18 -0
  72. package/dist/QueryClientConsumer-YLHVJlTq.d.mts.map +1 -0
  73. package/dist/QueryClientConsumer.cjs +2 -14
  74. package/dist/QueryClientConsumer.d.cts +2 -18
  75. package/dist/QueryClientConsumer.d.mts +2 -18
  76. package/dist/QueryClientConsumer.mjs +2 -13
  77. package/dist/SuspenseInfiniteQuery-BZ3SvXkD.mjs +30 -0
  78. package/dist/SuspenseInfiniteQuery-BZ3SvXkD.mjs.map +1 -0
  79. package/dist/SuspenseInfiniteQuery-ByTjC7r9.d.cts +31 -0
  80. package/dist/SuspenseInfiniteQuery-ByTjC7r9.d.cts.map +1 -0
  81. package/dist/SuspenseInfiniteQuery-asj0bHeh.d.mts +31 -0
  82. package/dist/SuspenseInfiniteQuery-asj0bHeh.d.mts.map +1 -0
  83. package/dist/SuspenseInfiniteQuery-qAybH413.cjs +35 -0
  84. package/dist/SuspenseInfiniteQuery-qAybH413.cjs.map +1 -0
  85. package/dist/SuspenseInfiniteQuery.cjs +2 -30
  86. package/dist/SuspenseInfiniteQuery.d.cts +2 -31
  87. package/dist/SuspenseInfiniteQuery.d.mts +2 -31
  88. package/dist/SuspenseInfiniteQuery.mjs +2 -29
  89. package/dist/SuspenseQueries-CZJAU3Eq.d.cts +31 -0
  90. package/dist/SuspenseQueries-CZJAU3Eq.d.cts.map +1 -0
  91. package/dist/SuspenseQueries-DlBy4veI.cjs +31 -0
  92. package/dist/SuspenseQueries-DlBy4veI.cjs.map +1 -0
  93. package/dist/SuspenseQueries-Dv6SQx-C.mjs +26 -0
  94. package/dist/SuspenseQueries-Dv6SQx-C.mjs.map +1 -0
  95. package/dist/SuspenseQueries-Nv07W4mb.d.mts +31 -0
  96. package/dist/SuspenseQueries-Nv07W4mb.d.mts.map +1 -0
  97. package/dist/SuspenseQueries.cjs +2 -26
  98. package/dist/SuspenseQueries.d.cts +2 -30
  99. package/dist/SuspenseQueries.d.mts +2 -30
  100. package/dist/SuspenseQueries.mjs +2 -25
  101. package/dist/SuspenseQuery-BNAZi5mZ.d.cts +31 -0
  102. package/dist/SuspenseQuery-BNAZi5mZ.d.cts.map +1 -0
  103. package/dist/SuspenseQuery-CGEFuzI_.cjs +35 -0
  104. package/dist/SuspenseQuery-CGEFuzI_.cjs.map +1 -0
  105. package/dist/SuspenseQuery-RbgXq6PC.mjs +30 -0
  106. package/dist/SuspenseQuery-RbgXq6PC.mjs.map +1 -0
  107. package/dist/SuspenseQuery-uHIieJ1n.d.mts +31 -0
  108. package/dist/SuspenseQuery-uHIieJ1n.d.mts.map +1 -0
  109. package/dist/SuspenseQuery.cjs +2 -30
  110. package/dist/SuspenseQuery.d.cts +2 -30
  111. package/dist/SuspenseQuery.d.mts +2 -30
  112. package/dist/SuspenseQuery.mjs +2 -29
  113. package/dist/components/ClientOnly.cjs +2 -12
  114. package/dist/components/ClientOnly.d.cts +13 -0
  115. package/dist/components/ClientOnly.d.cts.map +1 -0
  116. package/dist/components/ClientOnly.d.mts +13 -0
  117. package/dist/components/ClientOnly.d.mts.map +1 -0
  118. package/dist/components/ClientOnly.mjs +2 -12
  119. package/dist/createGetQueryClient-Cg34XLqS.cjs +68 -0
  120. package/dist/createGetQueryClient-Cg34XLqS.cjs.map +1 -0
  121. package/dist/createGetQueryClient-Cjacpz3C.mjs +63 -0
  122. package/dist/createGetQueryClient-Cjacpz3C.mjs.map +1 -0
  123. package/dist/createGetQueryClient-DI5GrATJ.d.cts +54 -0
  124. package/dist/createGetQueryClient-DI5GrATJ.d.cts.map +1 -0
  125. package/dist/createGetQueryClient-UFf6keL9.d.mts +54 -0
  126. package/dist/createGetQueryClient-UFf6keL9.d.mts.map +1 -0
  127. package/dist/createGetQueryClient.cjs +2 -63
  128. package/dist/createGetQueryClient.d.cts +2 -53
  129. package/dist/createGetQueryClient.d.mts +2 -53
  130. package/dist/createGetQueryClient.mjs +2 -62
  131. package/dist/index.cjs +12 -27
  132. package/dist/index.d.cts +12 -19
  133. package/dist/index.d.mts +12 -19
  134. package/dist/index.mjs +12 -19
  135. package/dist/mutationOptions-BdXvKAld.d.mts +7 -0
  136. package/dist/mutationOptions-BdXvKAld.d.mts.map +1 -0
  137. package/dist/mutationOptions-CBUqQakM.mjs +8 -0
  138. package/dist/mutationOptions-CBUqQakM.mjs.map +1 -0
  139. package/dist/mutationOptions-CzTorL9K.d.cts +7 -0
  140. package/dist/mutationOptions-CzTorL9K.d.cts.map +1 -0
  141. package/dist/mutationOptions-DNgLRYqd.cjs +14 -0
  142. package/dist/mutationOptions-DNgLRYqd.cjs.map +1 -0
  143. package/dist/mutationOptions.cjs +2 -9
  144. package/dist/mutationOptions.d.cts +2 -7
  145. package/dist/mutationOptions.d.mts +2 -7
  146. package/dist/mutationOptions.mjs +2 -7
  147. package/dist/objectSpread2-DTjFl4q7.mjs +67 -0
  148. package/dist/objectSpread2-DUnXKO-7.cjs +73 -0
  149. package/dist/objectWithoutProperties-BqF6LYLG.cjs +31 -0
  150. package/dist/objectWithoutProperties-DB_n2qVi.mjs +25 -0
  151. package/package.json +4 -4
  152. package/src/IsFetching.tsx +2 -3
  153. package/src/Mutation.tsx +1 -0
  154. package/src/PrefetchInfiniteQuery.tsx +8 -3
  155. package/src/PrefetchQuery.tsx +3 -3
  156. package/src/QueryClientConsumer.tsx +1 -0
  157. package/src/SuspenseInfiniteQuery.tsx +23 -2
  158. package/src/SuspenseQueries.tsx +1 -0
  159. package/src/SuspenseQuery.tsx +1 -0
  160. package/src/components/ClientOnly.tsx +1 -0
  161. package/src/createGetQueryClient.spec.tsx +77 -25
  162. package/src/index.ts +1 -14
  163. package/dist/IsFetching.cjs.map +0 -1
  164. package/dist/IsFetching.d.cts.map +0 -1
  165. package/dist/IsFetching.d.mts.map +0 -1
  166. package/dist/IsFetching.mjs.map +0 -1
  167. package/dist/Mutation.cjs.map +0 -1
  168. package/dist/Mutation.d.cts.map +0 -1
  169. package/dist/Mutation.d.mts.map +0 -1
  170. package/dist/Mutation.mjs.map +0 -1
  171. package/dist/PrefetchInfiniteQuery.cjs.map +0 -1
  172. package/dist/PrefetchInfiniteQuery.d.cts.map +0 -1
  173. package/dist/PrefetchInfiniteQuery.d.mts.map +0 -1
  174. package/dist/PrefetchInfiniteQuery.mjs.map +0 -1
  175. package/dist/PrefetchQuery.cjs.map +0 -1
  176. package/dist/PrefetchQuery.d.cts.map +0 -1
  177. package/dist/PrefetchQuery.d.mts.map +0 -1
  178. package/dist/PrefetchQuery.mjs.map +0 -1
  179. package/dist/QueriesHydration.cjs.map +0 -1
  180. package/dist/QueriesHydration.d.cts.map +0 -1
  181. package/dist/QueriesHydration.d.mts.map +0 -1
  182. package/dist/QueriesHydration.mjs.map +0 -1
  183. package/dist/QueryClientConsumer.cjs.map +0 -1
  184. package/dist/QueryClientConsumer.d.cts.map +0 -1
  185. package/dist/QueryClientConsumer.d.mts.map +0 -1
  186. package/dist/QueryClientConsumer.mjs.map +0 -1
  187. package/dist/SuspenseInfiniteQuery.cjs.map +0 -1
  188. package/dist/SuspenseInfiniteQuery.d.cts.map +0 -1
  189. package/dist/SuspenseInfiniteQuery.d.mts.map +0 -1
  190. package/dist/SuspenseInfiniteQuery.mjs.map +0 -1
  191. package/dist/SuspenseQueries.cjs.map +0 -1
  192. package/dist/SuspenseQueries.d.cts.map +0 -1
  193. package/dist/SuspenseQueries.d.mts.map +0 -1
  194. package/dist/SuspenseQueries.mjs.map +0 -1
  195. package/dist/SuspenseQuery.cjs.map +0 -1
  196. package/dist/SuspenseQuery.d.cts.map +0 -1
  197. package/dist/SuspenseQuery.d.mts.map +0 -1
  198. package/dist/SuspenseQuery.mjs.map +0 -1
  199. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.cjs +0 -29
  200. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.mjs +0 -28
  201. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.cjs +0 -14
  202. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.mjs +0 -14
  203. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.cjs +0 -27
  204. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs +0 -27
  205. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs +0 -15
  206. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs +0 -15
  207. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.cjs +0 -14
  208. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.mjs +0 -13
  209. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.cjs +0 -16
  210. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.mjs +0 -16
  211. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.cjs +0 -11
  212. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.mjs +0 -11
  213. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.cjs +0 -18
  214. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.mjs +0 -12
  215. package/dist/components/ClientOnly.cjs.map +0 -1
  216. package/dist/components/ClientOnly.mjs.map +0 -1
  217. package/dist/createGetQueryClient.cjs.map +0 -1
  218. package/dist/createGetQueryClient.d.cts.map +0 -1
  219. package/dist/createGetQueryClient.d.mts.map +0 -1
  220. package/dist/createGetQueryClient.mjs.map +0 -1
  221. package/dist/infiniteQueryOptions.cjs +0 -18
  222. package/dist/infiniteQueryOptions.cjs.map +0 -1
  223. package/dist/infiniteQueryOptions.d.cts +0 -28
  224. package/dist/infiniteQueryOptions.d.cts.map +0 -1
  225. package/dist/infiniteQueryOptions.d.mts +0 -28
  226. package/dist/infiniteQueryOptions.d.mts.map +0 -1
  227. package/dist/infiniteQueryOptions.mjs +0 -17
  228. package/dist/infiniteQueryOptions.mjs.map +0 -1
  229. package/dist/mutationOptions.cjs.map +0 -1
  230. package/dist/mutationOptions.d.cts.map +0 -1
  231. package/dist/mutationOptions.d.mts.map +0 -1
  232. package/dist/mutationOptions.mjs.map +0 -1
  233. package/dist/queryOptions.cjs +0 -18
  234. package/dist/queryOptions.cjs.map +0 -1
  235. package/dist/queryOptions.d.cts +0 -28
  236. package/dist/queryOptions.d.cts.map +0 -1
  237. package/dist/queryOptions.d.mts +0 -28
  238. package/dist/queryOptions.d.mts.map +0 -1
  239. package/dist/queryOptions.mjs +0 -17
  240. package/dist/queryOptions.mjs.map +0 -1
  241. package/dist/usePrefetchInfiniteQuery.cjs +0 -18
  242. package/dist/usePrefetchInfiniteQuery.cjs.map +0 -1
  243. package/dist/usePrefetchInfiniteQuery.d.cts +0 -11
  244. package/dist/usePrefetchInfiniteQuery.d.cts.map +0 -1
  245. package/dist/usePrefetchInfiniteQuery.d.mts +0 -11
  246. package/dist/usePrefetchInfiniteQuery.d.mts.map +0 -1
  247. package/dist/usePrefetchInfiniteQuery.mjs +0 -17
  248. package/dist/usePrefetchInfiniteQuery.mjs.map +0 -1
  249. package/dist/usePrefetchQuery.cjs +0 -18
  250. package/dist/usePrefetchQuery.cjs.map +0 -1
  251. package/dist/usePrefetchQuery.d.cts +0 -11
  252. package/dist/usePrefetchQuery.d.cts.map +0 -1
  253. package/dist/usePrefetchQuery.d.mts +0 -11
  254. package/dist/usePrefetchQuery.d.mts.map +0 -1
  255. package/dist/usePrefetchQuery.mjs +0 -17
  256. package/dist/usePrefetchQuery.mjs.map +0 -1
  257. package/dist/useSuspenseInfiniteQuery.cjs +0 -20
  258. package/dist/useSuspenseInfiniteQuery.cjs.map +0 -1
  259. package/dist/useSuspenseInfiniteQuery.d.cts +0 -17
  260. package/dist/useSuspenseInfiniteQuery.d.cts.map +0 -1
  261. package/dist/useSuspenseInfiniteQuery.d.mts +0 -17
  262. package/dist/useSuspenseInfiniteQuery.d.mts.map +0 -1
  263. package/dist/useSuspenseInfiniteQuery.mjs +0 -19
  264. package/dist/useSuspenseInfiniteQuery.mjs.map +0 -1
  265. package/dist/useSuspenseQueries.cjs +0 -20
  266. package/dist/useSuspenseQueries.cjs.map +0 -1
  267. package/dist/useSuspenseQueries.d.cts +0 -36
  268. package/dist/useSuspenseQueries.d.cts.map +0 -1
  269. package/dist/useSuspenseQueries.d.mts +0 -36
  270. package/dist/useSuspenseQueries.d.mts.map +0 -1
  271. package/dist/useSuspenseQueries.mjs +0 -19
  272. package/dist/useSuspenseQueries.mjs.map +0 -1
  273. package/dist/useSuspenseQuery.cjs +0 -20
  274. package/dist/useSuspenseQuery.cjs.map +0 -1
  275. package/dist/useSuspenseQuery.d.cts +0 -36
  276. package/dist/useSuspenseQuery.d.cts.map +0 -1
  277. package/dist/useSuspenseQuery.d.mts +0 -36
  278. package/dist/useSuspenseQuery.d.mts.map +0 -1
  279. package/dist/useSuspenseQuery.mjs +0 -19
  280. package/dist/useSuspenseQuery.mjs.map +0 -1
  281. package/src/IsFetching.spec.tsx +0 -34
  282. package/src/infiniteQueryOptions.ts +0 -77
  283. package/src/queryOptions.ts +0 -80
  284. package/src/usePrefetchInfiniteQuery.test-d.tsx +0 -14
  285. package/src/usePrefetchInfiniteQuery.ts +0 -19
  286. package/src/usePrefetchQuery.test-d.tsx +0 -14
  287. package/src/usePrefetchQuery.ts +0 -19
  288. package/src/useSuspenseInfiniteQuery.ts +0 -34
  289. package/src/useSuspenseQueries.ts +0 -47
  290. package/src/useSuspenseQuery.ts +0 -39
@@ -0,0 +1,106 @@
1
+ import { HydrateProps, OmitKeyof, QueryClient, QueryOptions, UseInfiniteQueryOptions, WithRequired } from "@tanstack/react-query";
2
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
3
+ import { ReactNode } from "react";
4
+
5
+ //#region src/QueriesHydration.d.ts
6
+
7
+ /**
8
+ * A server component that fetches multiple queries on the server and hydrates them to the client.
9
+ *
10
+ * @experimental This component is experimental and may be changed or removed in the future.
11
+ *
12
+ * @description
13
+ * QueriesHydration is designed for React Server Components (RSC).
14
+ * It pre-fetches multiple queries on the server side and automatically hydrates
15
+ * the data to the client, enabling seamless data synchronization between server and client.
16
+ *
17
+ * When errors occur during server-side fetching, the component gracefully falls back
18
+ * to client-side rendering, ensuring your application remains resilient.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * // app/page.tsx (Server Component)
23
+ * import { Suspense } from 'react'
24
+ * import { QueriesHydration } from '@suspensive/react-query'
25
+ * import { queryOptions } from '@tanstack/react-query'
26
+ *
27
+ * const userQueryOptions = (userId: string) => queryOptions({
28
+ * queryKey: ['user', userId],
29
+ * queryFn: () => fetchUser(userId)
30
+ * })
31
+ *
32
+ * const postsQueryOptions = () => queryOptions({
33
+ * queryKey: ['posts'],
34
+ * queryFn: () => fetchPosts()
35
+ * })
36
+ *
37
+ * export default function Page({ userId }: { userId: string }) {
38
+ * return (
39
+ * <>
40
+ * <Suspense fallback={<div>Loading user...</div>}>
41
+ * <QueriesHydration queries={[userQueryOptions(userId)]}>
42
+ * <UserProfile />
43
+ * </QueriesHydration>
44
+ * </Suspense>
45
+ *
46
+ * <Suspense fallback={<div>Loading posts...</div>}>
47
+ * <QueriesHydration queries={[postsQueryOptions()]}>
48
+ * <PostsList />
49
+ * </QueriesHydration>
50
+ * </Suspense>
51
+ * </>
52
+ * )
53
+ * }
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```tsx
58
+ * // With custom error fallback
59
+ * <Suspense fallback={<div>Loading user...</div>}>
60
+ * <QueriesHydration
61
+ * queries={[userQueryOptions(userId)]}
62
+ * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
63
+ * >
64
+ * <UserProfile />
65
+ * </QueriesHydration>
66
+ * </Suspense>
67
+ * ```
68
+ *
69
+ * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
70
+ */
71
+ declare function QueriesHydration({
72
+ queries,
73
+ children,
74
+ queryClient,
75
+ skipSsrOnError,
76
+ timeout,
77
+ ...props
78
+ }: {
79
+ /**
80
+ * The QueryClient instance to use for fetching queries.
81
+ */
82
+ queryClient?: QueryClient;
83
+ /**
84
+ * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.
85
+ * You can mix regular queries and infinite queries in the same array.
86
+ */
87
+ queries: (WithRequired<QueryOptions<any, any, any, any>, 'queryKey'> | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>)[];
88
+ /**
89
+ * Controls error handling behavior:
90
+ * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails
91
+ * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)
92
+ * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering
93
+ */
94
+ skipSsrOnError?: boolean | {
95
+ fallback: ReactNode;
96
+ };
97
+ /**
98
+ * The timeout in milliseconds for the query.
99
+ * If the query takes longer than the timeout, it will be considered as an error.
100
+ * When not set, no timeout is applied.
101
+ */
102
+ timeout?: number;
103
+ } & OmitKeyof<HydrateProps, 'state'>): Promise<react_jsx_runtime7.JSX.Element>;
104
+ //#endregion
105
+ export { QueriesHydration as t };
106
+ //# sourceMappingURL=QueriesHydration-D8Kdp7yq.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueriesHydration-D8Kdp7yq.d.mts","names":[],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AA6EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsB,gBAAA;;;;;;;;;;;gBAWN;;;;;YAMV,aAAa,gDACb,aAAa;;;;;;;;cAWD;;;;;;;;IAQd,UAAU,yBAAsB,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1,118 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_objectWithoutProperties = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs');
3
- const require_ClientOnly = require('./components/ClientOnly.cjs');
4
- const require_objectSpread2 = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.cjs');
5
- const require_asyncToGenerator = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.cjs');
6
- let _tanstack_react_query = require("@tanstack/react-query");
7
- let react_jsx_runtime = require("react/jsx-runtime");
1
+ const require_QueriesHydration = require('./QueriesHydration-Cd2lBXvZ.cjs');
8
2
 
9
- //#region src/QueriesHydration.tsx
10
- const _excluded = [
11
- "queries",
12
- "children",
13
- "queryClient",
14
- "skipSsrOnError",
15
- "timeout"
16
- ];
17
- /**
18
- * A server component that fetches multiple queries on the server and hydrates them to the client.
19
- *
20
- * @experimental This component is experimental and may be changed or removed in the future.
21
- *
22
- * @description
23
- * QueriesHydration is designed for React Server Components (RSC).
24
- * It pre-fetches multiple queries on the server side and automatically hydrates
25
- * the data to the client, enabling seamless data synchronization between server and client.
26
- *
27
- * When errors occur during server-side fetching, the component gracefully falls back
28
- * to client-side rendering, ensuring your application remains resilient.
29
- *
30
- * @example
31
- * ```tsx
32
- * // app/page.tsx (Server Component)
33
- * import { Suspense } from 'react'
34
- * import { QueriesHydration } from '@suspensive/react-query'
35
- * import { queryOptions } from '@tanstack/react-query'
36
- *
37
- * const userQueryOptions = (userId: string) => queryOptions({
38
- * queryKey: ['user', userId],
39
- * queryFn: () => fetchUser(userId)
40
- * })
41
- *
42
- * const postsQueryOptions = () => queryOptions({
43
- * queryKey: ['posts'],
44
- * queryFn: () => fetchPosts()
45
- * })
46
- *
47
- * export default function Page({ userId }: { userId: string }) {
48
- * return (
49
- * <>
50
- * <Suspense fallback={<div>Loading user...</div>}>
51
- * <QueriesHydration queries={[userQueryOptions(userId)]}>
52
- * <UserProfile />
53
- * </QueriesHydration>
54
- * </Suspense>
55
- *
56
- * <Suspense fallback={<div>Loading posts...</div>}>
57
- * <QueriesHydration queries={[postsQueryOptions()]}>
58
- * <PostsList />
59
- * </QueriesHydration>
60
- * </Suspense>
61
- * </>
62
- * )
63
- * }
64
- * ```
65
- *
66
- * @example
67
- * ```tsx
68
- * // With custom error fallback
69
- * <Suspense fallback={<div>Loading user...</div>}>
70
- * <QueriesHydration
71
- * queries={[userQueryOptions(userId)]}
72
- * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
73
- * >
74
- * <UserProfile />
75
- * </QueriesHydration>
76
- * </Suspense>
77
- * ```
78
- *
79
- * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
80
- */
81
- function QueriesHydration(_x) {
82
- return _QueriesHydration.apply(this, arguments);
83
- }
84
- function _QueriesHydration() {
85
- _QueriesHydration = require_asyncToGenerator._asyncToGenerator(function* (_ref) {
86
- let { queries, children, queryClient = new _tanstack_react_query.QueryClient(), skipSsrOnError = true, timeout } = _ref, props = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
87
- const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
88
- try {
89
- const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
90
- yield timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise;
91
- timeoutController === null || timeoutController === void 0 || timeoutController.clear();
92
- } catch (_unused) {
93
- timeoutController === null || timeoutController === void 0 || timeoutController.clear();
94
- if (skipSsrOnError) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ClientOnly.ClientOnly, {
95
- fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
96
- children
97
- });
98
- }
99
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tanstack_react_query.Hydrate, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, {
100
- state: (0, _tanstack_react_query.dehydrate)(queryClient),
101
- children
102
- }));
103
- });
104
- return _QueriesHydration.apply(this, arguments);
105
- }
106
- const createTimeoutController = (ms, errorMessage) => {
107
- let timerId;
108
- return {
109
- promise: new Promise((_, reject) => {
110
- timerId = setTimeout(() => reject(new Error(errorMessage)), ms);
111
- }),
112
- clear: () => timerId != null && clearTimeout(timerId)
113
- };
114
- };
115
-
116
- //#endregion
117
- exports.QueriesHydration = QueriesHydration;
118
- //# sourceMappingURL=QueriesHydration.cjs.map
3
+ exports.QueriesHydration = require_QueriesHydration.QueriesHydration;
@@ -1,105 +1,2 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
- import { HydrateProps, OmitKeyof, QueryClient, QueryOptions, UseInfiniteQueryOptions, WithRequired } from "@tanstack/react-query";
3
- import { ReactNode } from "react";
4
-
5
- //#region src/QueriesHydration.d.ts
6
- /**
7
- * A server component that fetches multiple queries on the server and hydrates them to the client.
8
- *
9
- * @experimental This component is experimental and may be changed or removed in the future.
10
- *
11
- * @description
12
- * QueriesHydration is designed for React Server Components (RSC).
13
- * It pre-fetches multiple queries on the server side and automatically hydrates
14
- * the data to the client, enabling seamless data synchronization between server and client.
15
- *
16
- * When errors occur during server-side fetching, the component gracefully falls back
17
- * to client-side rendering, ensuring your application remains resilient.
18
- *
19
- * @example
20
- * ```tsx
21
- * // app/page.tsx (Server Component)
22
- * import { Suspense } from 'react'
23
- * import { QueriesHydration } from '@suspensive/react-query'
24
- * import { queryOptions } from '@tanstack/react-query'
25
- *
26
- * const userQueryOptions = (userId: string) => queryOptions({
27
- * queryKey: ['user', userId],
28
- * queryFn: () => fetchUser(userId)
29
- * })
30
- *
31
- * const postsQueryOptions = () => queryOptions({
32
- * queryKey: ['posts'],
33
- * queryFn: () => fetchPosts()
34
- * })
35
- *
36
- * export default function Page({ userId }: { userId: string }) {
37
- * return (
38
- * <>
39
- * <Suspense fallback={<div>Loading user...</div>}>
40
- * <QueriesHydration queries={[userQueryOptions(userId)]}>
41
- * <UserProfile />
42
- * </QueriesHydration>
43
- * </Suspense>
44
- *
45
- * <Suspense fallback={<div>Loading posts...</div>}>
46
- * <QueriesHydration queries={[postsQueryOptions()]}>
47
- * <PostsList />
48
- * </QueriesHydration>
49
- * </Suspense>
50
- * </>
51
- * )
52
- * }
53
- * ```
54
- *
55
- * @example
56
- * ```tsx
57
- * // With custom error fallback
58
- * <Suspense fallback={<div>Loading user...</div>}>
59
- * <QueriesHydration
60
- * queries={[userQueryOptions(userId)]}
61
- * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
62
- * >
63
- * <UserProfile />
64
- * </QueriesHydration>
65
- * </Suspense>
66
- * ```
67
- *
68
- * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
69
- */
70
- declare function QueriesHydration({
71
- queries,
72
- children,
73
- queryClient,
74
- skipSsrOnError,
75
- timeout,
76
- ...props
77
- }: {
78
- /**
79
- * The QueryClient instance to use for fetching queries.
80
- */
81
- queryClient?: QueryClient;
82
- /**
83
- * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.
84
- * You can mix regular queries and infinite queries in the same array.
85
- */
86
- queries: (WithRequired<QueryOptions<any, any, any, any>, 'queryKey'> | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>)[];
87
- /**
88
- * Controls error handling behavior:
89
- * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails
90
- * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)
91
- * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering
92
- */
93
- skipSsrOnError?: boolean | {
94
- fallback: ReactNode;
95
- };
96
- /**
97
- * The timeout in milliseconds for the query.
98
- * If the query takes longer than the timeout, it will be considered as an error.
99
- * When not set, no timeout is applied.
100
- */
101
- timeout?: number;
102
- } & OmitKeyof<HydrateProps, 'state'>): Promise<react_jsx_runtime0.JSX.Element>;
103
- //#endregion
104
- export { QueriesHydration };
105
- //# sourceMappingURL=QueriesHydration.d.cts.map
1
+ import { t as QueriesHydration } from "./QueriesHydration-B28Xmf0f.cjs";
2
+ export { QueriesHydration };
@@ -1,105 +1,2 @@
1
- import { HydrateProps, OmitKeyof, QueryClient, QueryOptions, UseInfiniteQueryOptions, WithRequired } from "@tanstack/react-query";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
- import { ReactNode } from "react";
4
-
5
- //#region src/QueriesHydration.d.ts
6
- /**
7
- * A server component that fetches multiple queries on the server and hydrates them to the client.
8
- *
9
- * @experimental This component is experimental and may be changed or removed in the future.
10
- *
11
- * @description
12
- * QueriesHydration is designed for React Server Components (RSC).
13
- * It pre-fetches multiple queries on the server side and automatically hydrates
14
- * the data to the client, enabling seamless data synchronization between server and client.
15
- *
16
- * When errors occur during server-side fetching, the component gracefully falls back
17
- * to client-side rendering, ensuring your application remains resilient.
18
- *
19
- * @example
20
- * ```tsx
21
- * // app/page.tsx (Server Component)
22
- * import { Suspense } from 'react'
23
- * import { QueriesHydration } from '@suspensive/react-query'
24
- * import { queryOptions } from '@tanstack/react-query'
25
- *
26
- * const userQueryOptions = (userId: string) => queryOptions({
27
- * queryKey: ['user', userId],
28
- * queryFn: () => fetchUser(userId)
29
- * })
30
- *
31
- * const postsQueryOptions = () => queryOptions({
32
- * queryKey: ['posts'],
33
- * queryFn: () => fetchPosts()
34
- * })
35
- *
36
- * export default function Page({ userId }: { userId: string }) {
37
- * return (
38
- * <>
39
- * <Suspense fallback={<div>Loading user...</div>}>
40
- * <QueriesHydration queries={[userQueryOptions(userId)]}>
41
- * <UserProfile />
42
- * </QueriesHydration>
43
- * </Suspense>
44
- *
45
- * <Suspense fallback={<div>Loading posts...</div>}>
46
- * <QueriesHydration queries={[postsQueryOptions()]}>
47
- * <PostsList />
48
- * </QueriesHydration>
49
- * </Suspense>
50
- * </>
51
- * )
52
- * }
53
- * ```
54
- *
55
- * @example
56
- * ```tsx
57
- * // With custom error fallback
58
- * <Suspense fallback={<div>Loading user...</div>}>
59
- * <QueriesHydration
60
- * queries={[userQueryOptions(userId)]}
61
- * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
62
- * >
63
- * <UserProfile />
64
- * </QueriesHydration>
65
- * </Suspense>
66
- * ```
67
- *
68
- * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
69
- */
70
- declare function QueriesHydration({
71
- queries,
72
- children,
73
- queryClient,
74
- skipSsrOnError,
75
- timeout,
76
- ...props
77
- }: {
78
- /**
79
- * The QueryClient instance to use for fetching queries.
80
- */
81
- queryClient?: QueryClient;
82
- /**
83
- * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.
84
- * You can mix regular queries and infinite queries in the same array.
85
- */
86
- queries: (WithRequired<QueryOptions<any, any, any, any>, 'queryKey'> | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>)[];
87
- /**
88
- * Controls error handling behavior:
89
- * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails
90
- * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)
91
- * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering
92
- */
93
- skipSsrOnError?: boolean | {
94
- fallback: ReactNode;
95
- };
96
- /**
97
- * The timeout in milliseconds for the query.
98
- * If the query takes longer than the timeout, it will be considered as an error.
99
- * When not set, no timeout is applied.
100
- */
101
- timeout?: number;
102
- } & OmitKeyof<HydrateProps, 'state'>): Promise<react_jsx_runtime0.JSX.Element>;
103
- //#endregion
104
- export { QueriesHydration };
105
- //# sourceMappingURL=QueriesHydration.d.mts.map
1
+ import { t as QueriesHydration } from "./QueriesHydration-D8Kdp7yq.mjs";
2
+ export { QueriesHydration };
@@ -1,117 +1,3 @@
1
- import { _objectWithoutProperties } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs";
2
- import { ClientOnly } from "./components/ClientOnly.mjs";
3
- import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs";
4
- import { _asyncToGenerator } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.mjs";
5
- import { Hydrate, QueryClient, dehydrate } from "@tanstack/react-query";
6
- import { jsx } from "react/jsx-runtime";
1
+ import { t as QueriesHydration } from "./QueriesHydration-CbLB0bKz.mjs";
7
2
 
8
- //#region src/QueriesHydration.tsx
9
- const _excluded = [
10
- "queries",
11
- "children",
12
- "queryClient",
13
- "skipSsrOnError",
14
- "timeout"
15
- ];
16
- /**
17
- * A server component that fetches multiple queries on the server and hydrates them to the client.
18
- *
19
- * @experimental This component is experimental and may be changed or removed in the future.
20
- *
21
- * @description
22
- * QueriesHydration is designed for React Server Components (RSC).
23
- * It pre-fetches multiple queries on the server side and automatically hydrates
24
- * the data to the client, enabling seamless data synchronization between server and client.
25
- *
26
- * When errors occur during server-side fetching, the component gracefully falls back
27
- * to client-side rendering, ensuring your application remains resilient.
28
- *
29
- * @example
30
- * ```tsx
31
- * // app/page.tsx (Server Component)
32
- * import { Suspense } from 'react'
33
- * import { QueriesHydration } from '@suspensive/react-query'
34
- * import { queryOptions } from '@tanstack/react-query'
35
- *
36
- * const userQueryOptions = (userId: string) => queryOptions({
37
- * queryKey: ['user', userId],
38
- * queryFn: () => fetchUser(userId)
39
- * })
40
- *
41
- * const postsQueryOptions = () => queryOptions({
42
- * queryKey: ['posts'],
43
- * queryFn: () => fetchPosts()
44
- * })
45
- *
46
- * export default function Page({ userId }: { userId: string }) {
47
- * return (
48
- * <>
49
- * <Suspense fallback={<div>Loading user...</div>}>
50
- * <QueriesHydration queries={[userQueryOptions(userId)]}>
51
- * <UserProfile />
52
- * </QueriesHydration>
53
- * </Suspense>
54
- *
55
- * <Suspense fallback={<div>Loading posts...</div>}>
56
- * <QueriesHydration queries={[postsQueryOptions()]}>
57
- * <PostsList />
58
- * </QueriesHydration>
59
- * </Suspense>
60
- * </>
61
- * )
62
- * }
63
- * ```
64
- *
65
- * @example
66
- * ```tsx
67
- * // With custom error fallback
68
- * <Suspense fallback={<div>Loading user...</div>}>
69
- * <QueriesHydration
70
- * queries={[userQueryOptions(userId)]}
71
- * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
72
- * >
73
- * <UserProfile />
74
- * </QueriesHydration>
75
- * </Suspense>
76
- * ```
77
- *
78
- * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
79
- */
80
- function QueriesHydration(_x) {
81
- return _QueriesHydration.apply(this, arguments);
82
- }
83
- function _QueriesHydration() {
84
- _QueriesHydration = _asyncToGenerator(function* (_ref) {
85
- let { queries, children, queryClient = new QueryClient(), skipSsrOnError = true, timeout } = _ref, props = _objectWithoutProperties(_ref, _excluded);
86
- const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
87
- try {
88
- const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
89
- yield timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise;
90
- timeoutController === null || timeoutController === void 0 || timeoutController.clear();
91
- } catch (_unused) {
92
- timeoutController === null || timeoutController === void 0 || timeoutController.clear();
93
- if (skipSsrOnError) return /* @__PURE__ */ jsx(ClientOnly, {
94
- fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
95
- children
96
- });
97
- }
98
- return /* @__PURE__ */ jsx(Hydrate, _objectSpread2(_objectSpread2({}, props), {}, {
99
- state: dehydrate(queryClient),
100
- children
101
- }));
102
- });
103
- return _QueriesHydration.apply(this, arguments);
104
- }
105
- const createTimeoutController = (ms, errorMessage) => {
106
- let timerId;
107
- return {
108
- promise: new Promise((_, reject) => {
109
- timerId = setTimeout(() => reject(new Error(errorMessage)), ms);
110
- }),
111
- clear: () => timerId != null && clearTimeout(timerId)
112
- };
113
- };
114
-
115
- //#endregion
116
- export { QueriesHydration };
117
- //# sourceMappingURL=QueriesHydration.mjs.map
3
+ export { QueriesHydration };
@@ -0,0 +1,14 @@
1
+ import { useQueryClient } from "@tanstack/react-query";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/QueryClientConsumer.tsx
5
+ /**
6
+ * @experimental This is experimental feature.
7
+ */
8
+ function QueryClientConsumer({ children, context }) {
9
+ return /* @__PURE__ */ jsx(Fragment, { children: children(useQueryClient({ context })) });
10
+ }
11
+
12
+ //#endregion
13
+ export { QueryClientConsumer as t };
14
+ //# sourceMappingURL=QueryClientConsumer-B5vPlxA7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryClientConsumer-B5vPlxA7.mjs","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":["'use client'\n\nimport { type QueryClient, useQueryClient } from '@tanstack/react-query'\nimport type { Context, ReactNode } from 'react'\n\n/**\n * @experimental This is experimental feature.\n */\nexport function QueryClientConsumer({\n children,\n context,\n}: {\n children: (queryClient: QueryClient) => ReactNode\n context?: Context<QueryClient | undefined>\n}) {\n return <>{children(useQueryClient({ context: context as any }))}</>\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,oBAAoB,EAClC,UACA,WAIC;AACD,QAAO,0CAAG,SAAS,eAAe,EAAW,SAAgB,CAAC,CAAC,GAAI"}
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import { QueryClient } from "@tanstack/react-query";
3
+ import { Context, ReactNode } from "react";
4
+
5
+ //#region src/QueryClientConsumer.d.ts
6
+ /**
7
+ * @experimental This is experimental feature.
8
+ */
9
+ declare function QueryClientConsumer({
10
+ children,
11
+ context
12
+ }: {
13
+ children: (queryClient: QueryClient) => ReactNode;
14
+ context?: Context<QueryClient | undefined>;
15
+ }): react_jsx_runtime4.JSX.Element;
16
+ //#endregion
17
+ export { QueryClientConsumer as t };
18
+ //# sourceMappingURL=QueryClientConsumer-COVqqi9y.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryClientConsumer-COVqqi9y.d.cts","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAQgB,iBAAA,mBAAA,CAAmB;EAAA,QAAA;EAAA;CAAA,EAAA;EACjC,QAAA,EAAA,CAAA,WAAA,EAGwB,WAHxB,EAAA,GAGwC,SAHxC;EACA,OAAA,CAAA,EAGU,OAHV,CAGkB,WAHlB,GAAA,SAAA,CAAA;CAEwB,CAAA,EAEzB,kBAAA,CAAA,GAAA,CAAA,OAFyB"}
@@ -0,0 +1,19 @@
1
+ let __tanstack_react_query = require("@tanstack/react-query");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+
4
+ //#region src/QueryClientConsumer.tsx
5
+ /**
6
+ * @experimental This is experimental feature.
7
+ */
8
+ function QueryClientConsumer({ children, context }) {
9
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children((0, __tanstack_react_query.useQueryClient)({ context })) });
10
+ }
11
+
12
+ //#endregion
13
+ Object.defineProperty(exports, 'QueryClientConsumer', {
14
+ enumerable: true,
15
+ get: function () {
16
+ return QueryClientConsumer;
17
+ }
18
+ });
19
+ //# sourceMappingURL=QueryClientConsumer-CsNJXJGM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryClientConsumer-CsNJXJGM.cjs","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":["'use client'\n\nimport { type QueryClient, useQueryClient } from '@tanstack/react-query'\nimport type { Context, ReactNode } from 'react'\n\n/**\n * @experimental This is experimental feature.\n */\nexport function QueryClientConsumer({\n children,\n context,\n}: {\n children: (queryClient: QueryClient) => ReactNode\n context?: Context<QueryClient | undefined>\n}) {\n return <>{children(useQueryClient({ context: context as any }))}</>\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,oBAAoB,EAClC,UACA,WAIC;AACD,QAAO,mFAAG,oDAAwB,EAAW,SAAgB,CAAC,CAAC,GAAI"}
@@ -0,0 +1,18 @@
1
+ import { QueryClient } from "@tanstack/react-query";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
+ import { Context, ReactNode } from "react";
4
+
5
+ //#region src/QueryClientConsumer.d.ts
6
+ /**
7
+ * @experimental This is experimental feature.
8
+ */
9
+ declare function QueryClientConsumer({
10
+ children,
11
+ context
12
+ }: {
13
+ children: (queryClient: QueryClient) => ReactNode;
14
+ context?: Context<QueryClient | undefined>;
15
+ }): react_jsx_runtime2.JSX.Element;
16
+ //#endregion
17
+ export { QueryClientConsumer as t };
18
+ //# sourceMappingURL=QueryClientConsumer-YLHVJlTq.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryClientConsumer-YLHVJlTq.d.mts","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAQgB,iBAAA,mBAAA,CAAmB;EAAA,QAAA;EAAA;CAAA,EAAA;EACjC,QAAA,EAAA,CAAA,WAAA,EAGwB,WAHxB,EAAA,GAGwC,SAHxC;EACA,OAAA,CAAA,EAGU,OAHV,CAGkB,WAHlB,GAAA,SAAA,CAAA;CAEwB,CAAA,EAEzB,kBAAA,CAAA,GAAA,CAAA,OAFyB"}
@@ -1,17 +1,5 @@
1
1
  'use client';
2
2
 
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- let _tanstack_react_query = require("@tanstack/react-query");
5
- let react_jsx_runtime = require("react/jsx-runtime");
3
+ const require_QueryClientConsumer = require('./QueryClientConsumer-CsNJXJGM.cjs');
6
4
 
7
- //#region src/QueryClientConsumer.tsx
8
- /**
9
- * @experimental This is experimental feature.
10
- */
11
- function QueryClientConsumer({ children, context }) {
12
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children((0, _tanstack_react_query.useQueryClient)({ context })) });
13
- }
14
-
15
- //#endregion
16
- exports.QueryClientConsumer = QueryClientConsumer;
17
- //# sourceMappingURL=QueryClientConsumer.cjs.map
5
+ exports.QueryClientConsumer = require_QueryClientConsumer.QueryClientConsumer;