@suspensive/react-query-4 3.18.0 → 3.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{PrefetchInfiniteQuery-C4FsMPPo.d.cts → PrefetchInfiniteQuery-DgZfL2Sb.d.cts} +3 -3
  2. package/dist/{PrefetchInfiniteQuery-C4FsMPPo.d.cts.map → PrefetchInfiniteQuery-DgZfL2Sb.d.cts.map} +1 -1
  3. package/dist/PrefetchInfiniteQuery.d.cts +1 -1
  4. package/dist/{PrefetchQuery-DFwiRhmK.d.cts → PrefetchQuery-CeQ0yxDL.d.cts} +3 -3
  5. package/dist/{PrefetchQuery-DFwiRhmK.d.cts.map → PrefetchQuery-CeQ0yxDL.d.cts.map} +1 -1
  6. package/dist/PrefetchQuery.d.cts +1 -1
  7. package/dist/{QueriesHydration-BrMSJHsz.mjs → QueriesHydration-27lFZeB8.mjs} +18 -4
  8. package/dist/QueriesHydration-27lFZeB8.mjs.map +1 -0
  9. package/dist/{QueriesHydration-99AzKj29.d.cts → QueriesHydration-B89HKn9y.d.cts} +10 -3
  10. package/dist/QueriesHydration-B89HKn9y.d.cts.map +1 -0
  11. package/dist/{QueriesHydration-BARmyHJu.cjs → QueriesHydration-BYKU-Mte.cjs} +18 -4
  12. package/dist/QueriesHydration-BYKU-Mte.cjs.map +1 -0
  13. package/dist/{QueriesHydration-M2zoVGgJ.d.mts → QueriesHydration-BeMkJU3l.d.mts} +8 -1
  14. package/dist/QueriesHydration-BeMkJU3l.d.mts.map +1 -0
  15. package/dist/QueriesHydration.cjs +1 -1
  16. package/dist/QueriesHydration.d.cts +1 -1
  17. package/dist/QueriesHydration.d.mts +1 -1
  18. package/dist/QueriesHydration.mjs +1 -1
  19. package/dist/{QueryClientConsumer-BGHJsJCv.d.cts → QueryClientConsumer-D3h25GmM.d.cts} +3 -3
  20. package/dist/{QueryClientConsumer-BGHJsJCv.d.cts.map → QueryClientConsumer-D3h25GmM.d.cts.map} +1 -1
  21. package/dist/{QueryClientConsumer-BW1kmzJX.d.mts → QueryClientConsumer-DNkucS1e.d.mts} +3 -3
  22. package/dist/{QueryClientConsumer-BW1kmzJX.d.mts.map → QueryClientConsumer-DNkucS1e.d.mts.map} +1 -1
  23. package/dist/QueryClientConsumer.d.cts +1 -1
  24. package/dist/QueryClientConsumer.d.mts +1 -1
  25. package/dist/{SuspenseInfiniteQuery-BwSKmJgm.d.cts → SuspenseInfiniteQuery-Bt7GeiHi.d.cts} +3 -3
  26. package/dist/{SuspenseInfiniteQuery-B6hHnPDQ.d.mts.map → SuspenseInfiniteQuery-Bt7GeiHi.d.cts.map} +1 -1
  27. package/dist/{SuspenseInfiniteQuery-B6hHnPDQ.d.mts → SuspenseInfiniteQuery-CSd2Hyym.d.mts} +3 -3
  28. package/dist/{SuspenseInfiniteQuery-BwSKmJgm.d.cts.map → SuspenseInfiniteQuery-CSd2Hyym.d.mts.map} +1 -1
  29. package/dist/SuspenseInfiniteQuery.d.cts +1 -1
  30. package/dist/SuspenseInfiniteQuery.d.mts +1 -1
  31. package/dist/{SuspenseQuery-BT6EsguP.d.cts → SuspenseQuery-BKoPQQ_o.d.cts} +3 -3
  32. package/dist/{SuspenseQuery-BT6EsguP.d.cts.map → SuspenseQuery-BKoPQQ_o.d.cts.map} +1 -1
  33. package/dist/SuspenseQuery.d.cts +1 -1
  34. package/dist/components/ClientOnly.d.cts +2 -2
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.d.cts +6 -6
  37. package/dist/index.d.mts +3 -3
  38. package/dist/index.mjs +1 -1
  39. package/package.json +1 -1
  40. package/src/QueriesHydration.spec.tsx +38 -1
  41. package/src/QueriesHydration.tsx +25 -1
  42. package/dist/QueriesHydration-99AzKj29.d.cts.map +0 -1
  43. package/dist/QueriesHydration-BARmyHJu.cjs.map +0 -1
  44. package/dist/QueriesHydration-BrMSJHsz.mjs.map +0 -1
  45. package/dist/QueriesHydration-M2zoVGgJ.d.mts.map +0 -1
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
2
  import { FetchInfiniteQueryOptions, QueryKey } from "@tanstack/react-query";
3
3
 
4
4
  //#region src/PrefetchInfiniteQuery.d.ts
@@ -11,7 +11,7 @@ import { FetchInfiniteQueryOptions, QueryKey } from "@tanstack/react-query";
11
11
  * <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />
12
12
  * ```
13
13
  */
14
- declare function PrefetchInfiniteQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime4.JSX.Element;
14
+ declare function PrefetchInfiniteQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime1.JSX.Element;
15
15
  //#endregion
16
16
  export { PrefetchInfiniteQuery as t };
17
- //# sourceMappingURL=PrefetchInfiniteQuery-C4FsMPPo.d.cts.map
17
+ //# sourceMappingURL=PrefetchInfiniteQuery-DgZfL2Sb.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrefetchInfiniteQuery-C4FsMPPo.d.cts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;;;;;AAKmD,iBALnC,qBAKmC,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAFzC,YAEyC,EAAA,kBAD/B,QAC+B,GADpB,QACoB,CAAA,CAAA,OAAA,EAAxC,yBAAwC,CAAd,YAAc,EAAA,MAAA,EAAQ,KAAR,EAAe,SAAf,CAAA,CAAA,EAAyB,kBAAA,CAAA,GAAA,CAAA,OAAzB"}
1
+ {"version":3,"file":"PrefetchInfiniteQuery-DgZfL2Sb.d.cts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;;;;;AAKmD,iBALnC,qBAKmC,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAFzC,YAEyC,EAAA,kBAD/B,QAC+B,GADpB,QACoB,CAAA,CAAA,OAAA,EAAxC,yBAAwC,CAAd,YAAc,EAAA,MAAA,EAAQ,KAAR,EAAe,SAAf,CAAA,CAAA,EAAyB,kBAAA,CAAA,GAAA,CAAA,OAAzB"}
@@ -1,2 +1,2 @@
1
- import { t as PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery-C4FsMPPo.cjs";
1
+ import { t as PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery-DgZfL2Sb.cjs";
2
2
  export { PrefetchInfiniteQuery };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime7 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
2
  import { FetchQueryOptions, QueryKey } from "@tanstack/react-query";
3
3
 
4
4
  //#region src/PrefetchQuery.d.ts
@@ -11,7 +11,7 @@ import { FetchQueryOptions, QueryKey } from "@tanstack/react-query";
11
11
  * <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />
12
12
  * ```
13
13
  */
14
- declare function PrefetchQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime7.JSX.Element;
14
+ declare function PrefetchQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime2.JSX.Element;
15
15
  //#endregion
16
16
  export { PrefetchQuery as t };
17
- //# sourceMappingURL=PrefetchQuery-DFwiRhmK.d.cts.map
17
+ //# sourceMappingURL=PrefetchQuery-CeQ0yxDL.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrefetchQuery-DFwiRhmK.d.cts","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;;;;;AAK2C,iBAL3B,aAK2B,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAFjC,YAEiC,EAAA,kBADvB,QACuB,GADZ,QACY,CAAA,CAAA,OAAA,EAAhC,iBAAgC,CAAd,YAAc,EAAA,MAAA,EAAQ,KAAR,EAAe,SAAf,CAAA,CAAA,EAAyB,kBAAA,CAAA,GAAA,CAAA,OAAzB"}
1
+ {"version":3,"file":"PrefetchQuery-CeQ0yxDL.d.cts","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;;;;;AAK2C,iBAL3B,aAK2B,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAFjC,YAEiC,EAAA,kBADvB,QACuB,GADZ,QACY,CAAA,CAAA,OAAA,EAAhC,iBAAgC,CAAd,YAAc,EAAA,MAAA,EAAQ,KAAR,EAAe,SAAf,CAAA,CAAA,EAAyB,kBAAA,CAAA,GAAA,CAAA,OAAzB"}
@@ -1,2 +1,2 @@
1
- import { t as PrefetchQuery } from "./PrefetchQuery-DFwiRhmK.cjs";
1
+ import { t as PrefetchQuery } from "./PrefetchQuery-CeQ0yxDL.cjs";
2
2
  export { PrefetchQuery };
@@ -36,7 +36,8 @@ const _excluded = [
36
36
  "queries",
37
37
  "children",
38
38
  "queryClient",
39
- "skipSsrOnError"
39
+ "skipSsrOnError",
40
+ "timeout"
40
41
  ];
41
42
  /**
42
43
  * A server component that fetches multiple queries on the server and hydrates them to the client.
@@ -107,10 +108,14 @@ function QueriesHydration(_x) {
107
108
  }
108
109
  function _QueriesHydration() {
109
110
  _QueriesHydration = _asyncToGenerator(function* (_ref) {
110
- let { queries, children, queryClient = new QueryClient(), skipSsrOnError = true } = _ref, props = _objectWithoutProperties(_ref, _excluded);
111
+ let { queries, children, queryClient = new QueryClient(), skipSsrOnError = true, timeout } = _ref, props = _objectWithoutProperties(_ref, _excluded);
112
+ const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
111
113
  try {
112
- yield Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
114
+ const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
115
+ yield timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise;
116
+ timeoutController === null || timeoutController === void 0 || timeoutController.clear();
113
117
  } catch (_unused) {
118
+ timeoutController === null || timeoutController === void 0 || timeoutController.clear();
114
119
  if (skipSsrOnError) return /* @__PURE__ */ jsx(ClientOnly, {
115
120
  fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
116
121
  children
@@ -123,7 +128,16 @@ function _QueriesHydration() {
123
128
  });
124
129
  return _QueriesHydration.apply(this, arguments);
125
130
  }
131
+ const createTimeoutController = (ms, errorMessage) => {
132
+ let timerId;
133
+ return {
134
+ promise: new Promise((_, reject) => {
135
+ timerId = setTimeout(() => reject(new Error(errorMessage)), ms);
136
+ }),
137
+ clear: () => timerId != null && clearTimeout(timerId)
138
+ };
139
+ };
126
140
 
127
141
  //#endregion
128
142
  export { QueriesHydration as t };
129
- //# sourceMappingURL=QueriesHydration-BrMSJHsz.mjs.map
143
+ //# sourceMappingURL=QueriesHydration-27lFZeB8.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueriesHydration-27lFZeB8.mjs","names":["timerId: ReturnType<typeof setTimeout> | undefined"],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":["import {\n Hydrate,\n type HydrateProps,\n type OmitKeyof,\n QueryClient,\n type QueryOptions,\n type UseInfiniteQueryOptions,\n type WithRequired,\n dehydrate,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { ClientOnly } from './components/ClientOnly'\n\n/**\n * A server component that fetches multiple queries on the server and hydrates them to the client.\n *\n * @experimental This component is experimental and may be changed or removed in the future.\n *\n * @description\n * QueriesHydration is designed for React Server Components (RSC).\n * It pre-fetches multiple queries on the server side and automatically hydrates\n * the data to the client, enabling seamless data synchronization between server and client.\n *\n * When errors occur during server-side fetching, the component gracefully falls back\n * to client-side rendering, ensuring your application remains resilient.\n *\n * @example\n * ```tsx\n * // app/page.tsx (Server Component)\n * import { Suspense } from 'react'\n * import { QueriesHydration } from '@suspensive/react-query'\n * import { queryOptions } from '@tanstack/react-query'\n *\n * const userQueryOptions = (userId: string) => queryOptions({\n * queryKey: ['user', userId],\n * queryFn: () => fetchUser(userId)\n * })\n *\n * const postsQueryOptions = () => queryOptions({\n * queryKey: ['posts'],\n * queryFn: () => fetchPosts()\n * })\n *\n * export default function Page({ userId }: { userId: string }) {\n * return (\n * <>\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration queries={[userQueryOptions(userId)]}>\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n *\n * <Suspense fallback={<div>Loading posts...</div>}>\n * <QueriesHydration queries={[postsQueryOptions()]}>\n * <PostsList />\n * </QueriesHydration>\n * </Suspense>\n * </>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom error fallback\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration\n * queries={[userQueryOptions(userId)]}\n * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}\n * >\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n * ```\n *\n * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}\n */\nexport async function QueriesHydration({\n queries,\n children,\n queryClient = new QueryClient(),\n skipSsrOnError = true,\n timeout,\n ...props\n}: {\n /**\n * The QueryClient instance to use for fetching queries.\n */\n queryClient?: QueryClient\n /**\n * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.\n * You can mix regular queries and infinite queries in the same array.\n */\n queries: (\n | WithRequired<QueryOptions<any, any, any, any>, 'queryKey'>\n | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>\n )[]\n /**\n * Controls error handling behavior:\n * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails\n * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)\n * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering\n */\n skipSsrOnError?:\n | boolean\n | {\n fallback: ReactNode\n }\n /**\n * The timeout in milliseconds for the query.\n * If the query takes longer than the timeout, it will be considered as an error.\n * When not set, no timeout is applied.\n */\n timeout?: number\n} & OmitKeyof<HydrateProps, 'state'>) {\n const timeoutController =\n timeout != null && timeout >= 0\n ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`)\n : undefined\n try {\n const queriesPromise = Promise.all(\n queries.map((query) =>\n 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)\n )\n )\n await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)\n timeoutController?.clear()\n } catch {\n timeoutController?.clear()\n if (skipSsrOnError) {\n return (\n <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>\n )\n }\n }\n return (\n <Hydrate {...props} state={dehydrate(queryClient)}>\n {children}\n </Hydrate>\n )\n}\n\nconst createTimeoutController = (ms: number, errorMessage: string) => {\n let timerId: ReturnType<typeof setTimeout> | undefined\n return {\n promise: new Promise<never>((_, reject) => {\n timerId = setTimeout(() => reject(new Error(errorMessage)), ms)\n }),\n clear: () => timerId != null && clearTimeout(timerId),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALF,SAAsB,iBAAiB;;;;wDAqCD;MArCC,EACrC,SACA,UACA,cAAc,IAAI,aAAa,EAC/B,iBAAiB,MACjB,kBACG;EAgCH,MAAM,oBACJ,WAAW,QAAQ,WAAW,IAC1B,wBAAwB,SAAS,mCAAmC,QAAQ,MAAM,GAClF;AACN,MAAI;GACF,MAAM,iBAAiB,QAAQ,IAC7B,QAAQ,KAAK,UACX,sBAAsB,QAAQ,YAAY,mBAAmB,MAAM,GAAG,YAAY,WAAW,MAAM,CACpG,CACF;AACD,SAAO,qBAAqB,OAAO,QAAQ,KAAK,CAAC,gBAAgB,kBAAkB,QAAQ,CAAC,GAAG;AAC/F,mFAAmB,OAAO;oBACpB;AACN,mFAAmB,OAAO;AAC1B,OAAI,eACF,QACE,oBAAC;IAAW,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;KAAsB;;AAIlH,SACE,oBAAC,2CAAY;GAAO,OAAO,UAAU,YAAY;GAC9C;KACO;;;;AAId,MAAM,2BAA2B,IAAY,iBAAyB;CACpE,IAAIA;AACJ,QAAO;EACL,SAAS,IAAI,SAAgB,GAAG,WAAW;AACzC,aAAU,iBAAiB,OAAO,IAAI,MAAM,aAAa,CAAC,EAAE,GAAG;IAC/D;EACF,aAAa,WAAW,QAAQ,aAAa,QAAQ;EACtD"}
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
2
  import { HydrateProps, OmitKeyof, QueryClient, QueryOptions, UseInfiniteQueryOptions, WithRequired } from "@tanstack/react-query";
3
3
  import { ReactNode } from "react";
4
4
 
@@ -73,6 +73,7 @@ declare function QueriesHydration({
73
73
  children,
74
74
  queryClient,
75
75
  skipSsrOnError,
76
+ timeout,
76
77
  ...props
77
78
  }: {
78
79
  /**
@@ -93,7 +94,13 @@ declare function QueriesHydration({
93
94
  skipSsrOnError?: boolean | {
94
95
  fallback: ReactNode;
95
96
  };
96
- } & OmitKeyof<HydrateProps, 'state'>): Promise<react_jsx_runtime0.JSX.Element>;
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_runtime4.JSX.Element>;
97
104
  //#endregion
98
105
  export { QueriesHydration as t };
99
- //# sourceMappingURL=QueriesHydration-99AzKj29.d.cts.map
106
+ //# sourceMappingURL=QueriesHydration-B89HKn9y.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueriesHydration-B89HKn9y.d.cts","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"}
@@ -36,7 +36,8 @@ const _excluded = [
36
36
  "queries",
37
37
  "children",
38
38
  "queryClient",
39
- "skipSsrOnError"
39
+ "skipSsrOnError",
40
+ "timeout"
40
41
  ];
41
42
  /**
42
43
  * A server component that fetches multiple queries on the server and hydrates them to the client.
@@ -107,10 +108,14 @@ function QueriesHydration(_x) {
107
108
  }
108
109
  function _QueriesHydration() {
109
110
  _QueriesHydration = _asyncToGenerator(function* (_ref) {
110
- let { queries, children, queryClient = new __tanstack_react_query.QueryClient(), skipSsrOnError = true } = _ref, props = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
111
+ let { queries, children, queryClient = new __tanstack_react_query.QueryClient(), skipSsrOnError = true, timeout } = _ref, props = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
112
+ const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
111
113
  try {
112
- yield Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
114
+ const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
115
+ yield timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise;
116
+ timeoutController === null || timeoutController === void 0 || timeoutController.clear();
113
117
  } catch (_unused) {
118
+ timeoutController === null || timeoutController === void 0 || timeoutController.clear();
114
119
  if (skipSsrOnError) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ClientOnly.ClientOnly, {
115
120
  fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
116
121
  children
@@ -123,6 +128,15 @@ function _QueriesHydration() {
123
128
  });
124
129
  return _QueriesHydration.apply(this, arguments);
125
130
  }
131
+ const createTimeoutController = (ms, errorMessage) => {
132
+ let timerId;
133
+ return {
134
+ promise: new Promise((_, reject) => {
135
+ timerId = setTimeout(() => reject(new Error(errorMessage)), ms);
136
+ }),
137
+ clear: () => timerId != null && clearTimeout(timerId)
138
+ };
139
+ };
126
140
 
127
141
  //#endregion
128
142
  Object.defineProperty(exports, 'QueriesHydration', {
@@ -131,4 +145,4 @@ Object.defineProperty(exports, 'QueriesHydration', {
131
145
  return QueriesHydration;
132
146
  }
133
147
  });
134
- //# sourceMappingURL=QueriesHydration-BARmyHJu.cjs.map
148
+ //# sourceMappingURL=QueriesHydration-BYKU-Mte.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueriesHydration-BYKU-Mte.cjs","names":["QueryClient","ClientOnly","Hydrate","timerId: ReturnType<typeof setTimeout> | undefined"],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":["import {\n Hydrate,\n type HydrateProps,\n type OmitKeyof,\n QueryClient,\n type QueryOptions,\n type UseInfiniteQueryOptions,\n type WithRequired,\n dehydrate,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { ClientOnly } from './components/ClientOnly'\n\n/**\n * A server component that fetches multiple queries on the server and hydrates them to the client.\n *\n * @experimental This component is experimental and may be changed or removed in the future.\n *\n * @description\n * QueriesHydration is designed for React Server Components (RSC).\n * It pre-fetches multiple queries on the server side and automatically hydrates\n * the data to the client, enabling seamless data synchronization between server and client.\n *\n * When errors occur during server-side fetching, the component gracefully falls back\n * to client-side rendering, ensuring your application remains resilient.\n *\n * @example\n * ```tsx\n * // app/page.tsx (Server Component)\n * import { Suspense } from 'react'\n * import { QueriesHydration } from '@suspensive/react-query'\n * import { queryOptions } from '@tanstack/react-query'\n *\n * const userQueryOptions = (userId: string) => queryOptions({\n * queryKey: ['user', userId],\n * queryFn: () => fetchUser(userId)\n * })\n *\n * const postsQueryOptions = () => queryOptions({\n * queryKey: ['posts'],\n * queryFn: () => fetchPosts()\n * })\n *\n * export default function Page({ userId }: { userId: string }) {\n * return (\n * <>\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration queries={[userQueryOptions(userId)]}>\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n *\n * <Suspense fallback={<div>Loading posts...</div>}>\n * <QueriesHydration queries={[postsQueryOptions()]}>\n * <PostsList />\n * </QueriesHydration>\n * </Suspense>\n * </>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom error fallback\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration\n * queries={[userQueryOptions(userId)]}\n * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}\n * >\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n * ```\n *\n * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}\n */\nexport async function QueriesHydration({\n queries,\n children,\n queryClient = new QueryClient(),\n skipSsrOnError = true,\n timeout,\n ...props\n}: {\n /**\n * The QueryClient instance to use for fetching queries.\n */\n queryClient?: QueryClient\n /**\n * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.\n * You can mix regular queries and infinite queries in the same array.\n */\n queries: (\n | WithRequired<QueryOptions<any, any, any, any>, 'queryKey'>\n | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>\n )[]\n /**\n * Controls error handling behavior:\n * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails\n * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)\n * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering\n */\n skipSsrOnError?:\n | boolean\n | {\n fallback: ReactNode\n }\n /**\n * The timeout in milliseconds for the query.\n * If the query takes longer than the timeout, it will be considered as an error.\n * When not set, no timeout is applied.\n */\n timeout?: number\n} & OmitKeyof<HydrateProps, 'state'>) {\n const timeoutController =\n timeout != null && timeout >= 0\n ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`)\n : undefined\n try {\n const queriesPromise = Promise.all(\n queries.map((query) =>\n 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)\n )\n )\n await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)\n timeoutController?.clear()\n } catch {\n timeoutController?.clear()\n if (skipSsrOnError) {\n return (\n <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>\n )\n }\n }\n return (\n <Hydrate {...props} state={dehydrate(queryClient)}>\n {children}\n </Hydrate>\n )\n}\n\nconst createTimeoutController = (ms: number, errorMessage: string) => {\n let timerId: ReturnType<typeof setTimeout> | undefined\n return {\n promise: new Promise<never>((_, reject) => {\n timerId = setTimeout(() => reject(new Error(errorMessage)), ms)\n }),\n clear: () => timerId != null && clearTimeout(timerId),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALF,SAAsB,iBAAiB;;;;wDAqCD;MArCC,EACrC,SACA,UACA,cAAc,IAAIA,oCAAa,EAC/B,iBAAiB,MACjB,kBACG;EAgCH,MAAM,oBACJ,WAAW,QAAQ,WAAW,IAC1B,wBAAwB,SAAS,mCAAmC,QAAQ,MAAM,GAClF;AACN,MAAI;GACF,MAAM,iBAAiB,QAAQ,IAC7B,QAAQ,KAAK,UACX,sBAAsB,QAAQ,YAAY,mBAAmB,MAAM,GAAG,YAAY,WAAW,MAAM,CACpG,CACF;AACD,SAAO,qBAAqB,OAAO,QAAQ,KAAK,CAAC,gBAAgB,kBAAkB,QAAQ,CAAC,GAAG;AAC/F,mFAAmB,OAAO;oBACpB;AACN,mFAAmB,OAAO;AAC1B,OAAI,eACF,QACE,2CAACC;IAAW,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;KAAsB;;AAIlH,SACE,2CAACC,8GAAY;GAAO,6CAAiB,YAAY;GAC9C;KACO;;;;AAId,MAAM,2BAA2B,IAAY,iBAAyB;CACpE,IAAIC;AACJ,QAAO;EACL,SAAS,IAAI,SAAgB,GAAG,WAAW;AACzC,aAAU,iBAAiB,OAAO,IAAI,MAAM,aAAa,CAAC,EAAE,GAAG;IAC/D;EACF,aAAa,WAAW,QAAQ,aAAa,QAAQ;EACtD"}
@@ -73,6 +73,7 @@ declare function QueriesHydration({
73
73
  children,
74
74
  queryClient,
75
75
  skipSsrOnError,
76
+ timeout,
76
77
  ...props
77
78
  }: {
78
79
  /**
@@ -93,7 +94,13 @@ declare function QueriesHydration({
93
94
  skipSsrOnError?: boolean | {
94
95
  fallback: ReactNode;
95
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;
96
103
  } & OmitKeyof<HydrateProps, 'state'>): Promise<react_jsx_runtime3.JSX.Element>;
97
104
  //#endregion
98
105
  export { QueriesHydration as t };
99
- //# sourceMappingURL=QueriesHydration-M2zoVGgJ.d.mts.map
106
+ //# sourceMappingURL=QueriesHydration-BeMkJU3l.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueriesHydration-BeMkJU3l.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,3 +1,3 @@
1
- const require_QueriesHydration = require('./QueriesHydration-BARmyHJu.cjs');
1
+ const require_QueriesHydration = require('./QueriesHydration-BYKU-Mte.cjs');
2
2
 
3
3
  exports.QueriesHydration = require_QueriesHydration.QueriesHydration;
@@ -1,2 +1,2 @@
1
- import { t as QueriesHydration } from "./QueriesHydration-99AzKj29.cjs";
1
+ import { t as QueriesHydration } from "./QueriesHydration-B89HKn9y.cjs";
2
2
  export { QueriesHydration };
@@ -1,2 +1,2 @@
1
- import { t as QueriesHydration } from "./QueriesHydration-M2zoVGgJ.mjs";
1
+ import { t as QueriesHydration } from "./QueriesHydration-BeMkJU3l.mjs";
2
2
  export { QueriesHydration };
@@ -1,3 +1,3 @@
1
- import { t as QueriesHydration } from "./QueriesHydration-BrMSJHsz.mjs";
1
+ import { t as QueriesHydration } from "./QueriesHydration-27lFZeB8.mjs";
2
2
 
3
3
  export { QueriesHydration };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
2
2
  import { QueryClient } from "@tanstack/react-query";
3
3
  import { Context, ReactNode } from "react";
4
4
 
@@ -12,7 +12,7 @@ declare function QueryClientConsumer({
12
12
  }: {
13
13
  children: (queryClient: QueryClient) => ReactNode;
14
14
  context?: Context<QueryClient | undefined>;
15
- }): react_jsx_runtime1.JSX.Element;
15
+ }): react_jsx_runtime3.JSX.Element;
16
16
  //#endregion
17
17
  export { QueryClientConsumer as t };
18
- //# sourceMappingURL=QueryClientConsumer-BGHJsJCv.d.cts.map
18
+ //# sourceMappingURL=QueryClientConsumer-D3h25GmM.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientConsumer-BGHJsJCv.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"}
1
+ {"version":3,"file":"QueryClientConsumer-D3h25GmM.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"}
@@ -1,5 +1,5 @@
1
1
  import { QueryClient } from "@tanstack/react-query";
2
- import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
  import { Context, ReactNode } from "react";
4
4
 
5
5
  //#region src/QueryClientConsumer.d.ts
@@ -12,7 +12,7 @@ declare function QueryClientConsumer({
12
12
  }: {
13
13
  children: (queryClient: QueryClient) => ReactNode;
14
14
  context?: Context<QueryClient | undefined>;
15
- }): react_jsx_runtime4.JSX.Element;
15
+ }): react_jsx_runtime5.JSX.Element;
16
16
  //#endregion
17
17
  export { QueryClientConsumer as t };
18
- //# sourceMappingURL=QueryClientConsumer-BW1kmzJX.d.mts.map
18
+ //# sourceMappingURL=QueryClientConsumer-DNkucS1e.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryClientConsumer-BW1kmzJX.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
+ {"version":3,"file":"QueryClientConsumer-DNkucS1e.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,2 +1,2 @@
1
- import { t as QueryClientConsumer } from "./QueryClientConsumer-BGHJsJCv.cjs";
1
+ import { t as QueryClientConsumer } from "./QueryClientConsumer-D3h25GmM.cjs";
2
2
  export { QueryClientConsumer };
@@ -1,2 +1,2 @@
1
- import { t as QueryClientConsumer } from "./QueryClientConsumer-BW1kmzJX.mjs";
1
+ import { t as QueryClientConsumer } from "./QueryClientConsumer-DNkucS1e.mjs";
2
2
  export { QueryClientConsumer };
@@ -1,5 +1,5 @@
1
1
  import { t as UseSuspenseInfiniteQueryOptions } from "./useSuspenseInfiniteQuery-xXu-A7cX.cjs";
2
- import * as react_jsx_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import { QueryKey, UseSuspenseInfiniteQueryResult } from "@tanstack/react-query";
4
4
  import { ReactNode } from "react";
5
5
 
@@ -26,7 +26,7 @@ declare const SuspenseInfiniteQuery: <TQueryFnData = unknown, TError = unknown,
26
26
  ...options
27
27
  }: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
28
28
  children: (query: UseSuspenseInfiniteQueryResult<TData, TError>) => ReactNode;
29
- }) => react_jsx_runtime3.JSX.Element;
29
+ }) => react_jsx_runtime0.JSX.Element;
30
30
  //#endregion
31
31
  export { SuspenseInfiniteQuery as t };
32
- //# sourceMappingURL=SuspenseInfiniteQuery-BwSKmJgm.d.cts.map
32
+ //# sourceMappingURL=SuspenseInfiniteQuery-Bt7GeiHi.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuspenseInfiniteQuery-B6hHnPDQ.d.mts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;AAqBA;;;;;;;;;;;;;AASsE,cATzD,qBASyD,EAAA,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAN5D,YAM4D,EAAA,kBALlD,QAKkD,GALvC,QAKuC,CAAA,CAAA;EAAA,QAAA;EAAA,GAAA;CAAA,EADnE,+BACmE,CADnC,YACmC,EADrB,MACqB,EADb,KACa,EADN,SACM,CAAA,GAAA;EACrE,QAAA,EAAA,CAAA,KAAA,EADmB,8BACnB,CADkD,KAClD,EADyD,MACzD,CAAA,EAAA,GADqE,SACrE;CAAuD,EAAA,GAAvD,kBAAA,CAAA,GAAA,CAAA,OAAuD"}
1
+ {"version":3,"file":"SuspenseInfiniteQuery-Bt7GeiHi.d.cts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;AAqBA;;;;;;;;;;;;;AASsE,cATzD,qBASyD,EAAA,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAN5D,YAM4D,EAAA,kBALlD,QAKkD,GALvC,QAKuC,CAAA,CAAA;EAAA,QAAA;EAAA,GAAA;CAAA,EADnE,+BACmE,CADnC,YACmC,EADrB,MACqB,EADb,KACa,EADN,SACM,CAAA,GAAA;EACrE,QAAA,EAAA,CAAA,KAAA,EADmB,8BACnB,CADkD,KAClD,EADyD,MACzD,CAAA,EAAA,GADqE,SACrE;CAAuD,EAAA,GAAvD,kBAAA,CAAA,GAAA,CAAA,OAAuD"}
@@ -1,6 +1,6 @@
1
1
  import { t as UseSuspenseInfiniteQueryOptions } from "./useSuspenseInfiniteQuery-Bh0nh8Kc.mjs";
2
2
  import { QueryKey, UseSuspenseInfiniteQueryResult } from "@tanstack/react-query";
3
- import * as react_jsx_runtime5 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
4
4
  import { ReactNode } from "react";
5
5
 
6
6
  //#region src/SuspenseInfiniteQuery.d.ts
@@ -26,7 +26,7 @@ declare const SuspenseInfiniteQuery: <TQueryFnData = unknown, TError = unknown,
26
26
  ...options
27
27
  }: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
28
28
  children: (query: UseSuspenseInfiniteQueryResult<TData, TError>) => ReactNode;
29
- }) => react_jsx_runtime5.JSX.Element;
29
+ }) => react_jsx_runtime4.JSX.Element;
30
30
  //#endregion
31
31
  export { SuspenseInfiniteQuery as t };
32
- //# sourceMappingURL=SuspenseInfiniteQuery-B6hHnPDQ.d.mts.map
32
+ //# sourceMappingURL=SuspenseInfiniteQuery-CSd2Hyym.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuspenseInfiniteQuery-BwSKmJgm.d.cts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;AAqBA;;;;;;;;;;;;;AASsE,cATzD,qBASyD,EAAA,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAN5D,YAM4D,EAAA,kBALlD,QAKkD,GALvC,QAKuC,CAAA,CAAA;EAAA,QAAA;EAAA,GAAA;CAAA,EADnE,+BACmE,CADnC,YACmC,EADrB,MACqB,EADb,KACa,EADN,SACM,CAAA,GAAA;EACrE,QAAA,EAAA,CAAA,KAAA,EADmB,8BACnB,CADkD,KAClD,EADyD,MACzD,CAAA,EAAA,GADqE,SACrE;CAAuD,EAAA,GAAvD,kBAAA,CAAA,GAAA,CAAA,OAAuD"}
1
+ {"version":3,"file":"SuspenseInfiniteQuery-CSd2Hyym.d.mts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;AAqBA;;;;;;;;;;;;;AASsE,cATzD,qBASyD,EAAA,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAN5D,YAM4D,EAAA,kBALlD,QAKkD,GALvC,QAKuC,CAAA,CAAA;EAAA,QAAA;EAAA,GAAA;CAAA,EADnE,+BACmE,CADnC,YACmC,EADrB,MACqB,EADb,KACa,EADN,SACM,CAAA,GAAA;EACrE,QAAA,EAAA,CAAA,KAAA,EADmB,8BACnB,CADkD,KAClD,EADyD,MACzD,CAAA,EAAA,GADqE,SACrE;CAAuD,EAAA,GAAvD,kBAAA,CAAA,GAAA,CAAA,OAAuD"}
@@ -1,2 +1,2 @@
1
- import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-BwSKmJgm.cjs";
1
+ import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-Bt7GeiHi.cjs";
2
2
  export { SuspenseInfiniteQuery };
@@ -1,3 +1,3 @@
1
1
  import "./useSuspenseInfiniteQuery-Bh0nh8Kc.mjs";
2
- import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-B6hHnPDQ.mjs";
2
+ import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-CSd2Hyym.mjs";
3
3
  export { SuspenseInfiniteQuery };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
2
2
  import { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query";
3
3
  import { ReactNode } from "react";
4
4
 
@@ -25,7 +25,7 @@ declare const SuspenseQuery: <TQueryFnData = unknown, TError = unknown, TData =
25
25
  ...options
26
26
  }: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
27
27
  children: (queryResult: UseSuspenseQueryResult<TData, TError>) => ReactNode;
28
- }) => react_jsx_runtime2.JSX.Element;
28
+ }) => react_jsx_runtime8.JSX.Element;
29
29
  //#endregion
30
30
  export { SuspenseQuery as t };
31
- //# sourceMappingURL=SuspenseQuery-BT6EsguP.d.cts.map
31
+ //# sourceMappingURL=SuspenseQuery-BKoPQQ_o.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuspenseQuery-BT6EsguP.d.cts","names":[],"sources":["../src/SuspenseQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AA0BA;;;;;;;;;;;;;AASoE,cATvD,aASuD,EAAA,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAN1D,YAM0D,EAAA,kBALhD,QAKgD,GALrC,QAKqC,CAAA,CAAA;EAAA,QAAA;EAAA,GAAA;CAAA,EADjE,uBACiE,CADzC,YACyC,EAD3B,MAC2B,EADnB,KACmB,EADZ,SACY,CAAA,GAAA;EACnE,QAAA,EAAA,CAAA,WAAA,EADyB,sBACzB,CADgD,KAChD,EADuD,MACvD,CAAA,EAAA,GADmE,SACnE;CAA+C,EAAA,GAA/C,kBAAA,CAAA,GAAA,CAAA,OAA+C"}
1
+ {"version":3,"file":"SuspenseQuery-BKoPQQ_o.d.cts","names":[],"sources":["../src/SuspenseQuery.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AA0BA;;;;;;;;;;;;;AASoE,cATvD,aASuD,EAAA,CAAA,eAAA,OAAA,EAAA,SAAA,OAAA,EAAA,QAN1D,YAM0D,EAAA,kBALhD,QAKgD,GALrC,QAKqC,CAAA,CAAA;EAAA,QAAA;EAAA,GAAA;CAAA,EADjE,uBACiE,CADzC,YACyC,EAD3B,MAC2B,EADnB,KACmB,EADZ,SACY,CAAA,GAAA;EACnE,QAAA,EAAA,CAAA,WAAA,EADyB,sBACzB,CADgD,KAChD,EADuD,MACvD,CAAA,EAAA,GADmE,SACnE;CAA+C,EAAA,GAA/C,kBAAA,CAAA,GAAA,CAAA,OAA+C"}
@@ -1,2 +1,2 @@
1
- import { t as SuspenseQuery } from "./SuspenseQuery-BT6EsguP.cjs";
1
+ import { t as SuspenseQuery } from "./SuspenseQuery-BKoPQQ_o.cjs";
2
2
  export { SuspenseQuery };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime8 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/components/ClientOnly.d.ts
4
4
  declare const ClientOnly: ({
@@ -7,7 +7,7 @@ declare const ClientOnly: ({
7
7
  }: {
8
8
  children: React.ReactNode;
9
9
  fallback: React.ReactNode;
10
- }) => react_jsx_runtime8.JSX.Element;
10
+ }) => react_jsx_runtime7.JSX.Element;
11
11
  //#endregion
12
12
  export { ClientOnly };
13
13
  //# sourceMappingURL=ClientOnly.d.cts.map
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ const require_usePrefetchInfiniteQuery = require('./usePrefetchInfiniteQuery-BmZ
4
4
  const require_PrefetchInfiniteQuery = require('./PrefetchInfiniteQuery-cCSXqKVR.cjs');
5
5
  const require_usePrefetchQuery = require('./usePrefetchQuery-woiivAJc.cjs');
6
6
  const require_PrefetchQuery = require('./PrefetchQuery-0pdYNtpS.cjs');
7
- const require_QueriesHydration = require('./QueriesHydration-BARmyHJu.cjs');
7
+ const require_QueriesHydration = require('./QueriesHydration-BYKU-Mte.cjs');
8
8
  const require_QueryClientConsumer = require('./QueryClientConsumer-mF0OUwkq.cjs');
9
9
  const require_SuspenseInfiniteQuery = require('./SuspenseInfiniteQuery-Dq97Dear.cjs');
10
10
  const require_SuspenseQueries = require('./SuspenseQueries-Brk6gtMw.cjs');
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as IsFetching } from "./IsFetching-CThOxeZB.cjs";
2
2
  import { t as Mutation } from "./Mutation-Dt5kUsd8.cjs";
3
- import { t as PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery-C4FsMPPo.cjs";
4
- import { t as PrefetchQuery } from "./PrefetchQuery-DFwiRhmK.cjs";
5
- import { t as QueriesHydration } from "./QueriesHydration-99AzKj29.cjs";
6
- import { t as QueryClientConsumer } from "./QueryClientConsumer-BGHJsJCv.cjs";
3
+ import { t as PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery-DgZfL2Sb.cjs";
4
+ import { t as PrefetchQuery } from "./PrefetchQuery-CeQ0yxDL.cjs";
5
+ import { t as QueriesHydration } from "./QueriesHydration-B89HKn9y.cjs";
6
+ import { t as QueryClientConsumer } from "./QueryClientConsumer-D3h25GmM.cjs";
7
7
  import { n as UseSuspenseInfiniteQueryResult, r as useSuspenseInfiniteQuery, t as UseSuspenseInfiniteQueryOptions } from "./useSuspenseInfiniteQuery-xXu-A7cX.cjs";
8
- import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-BwSKmJgm.cjs";
8
+ import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-Bt7GeiHi.cjs";
9
9
  import { t as SuspenseQueries } from "./SuspenseQueries-B-UR1dnn.cjs";
10
- import { t as SuspenseQuery } from "./SuspenseQuery-BT6EsguP.cjs";
10
+ import { t as SuspenseQuery } from "./SuspenseQuery-BKoPQQ_o.cjs";
11
11
  import { t as createGetQueryClient } from "./createGetQueryClient-iXoXO7so.cjs";
12
12
  import { n as UnSelectedInfiniteOptions, r as infiniteQueryOptions, t as SelectedInfiniteOptions } from "./infiniteQueryOptions-Be7VYTUR.cjs";
13
13
  import { n as UnSelectedQueryOptions, r as queryOptions, t as SelectedQueryOptions } from "./queryOptions-DNGHeGX5.cjs";
package/dist/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import { t as IsFetching } from "./IsFetching-D3xmE2Kn.mjs";
2
2
  import { t as Mutation } from "./Mutation-CGpbCg54.mjs";
3
3
  import { t as PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery-Dzjm5lf8.mjs";
4
4
  import { t as PrefetchQuery } from "./PrefetchQuery-DAqAWOeP.mjs";
5
- import { t as QueriesHydration } from "./QueriesHydration-M2zoVGgJ.mjs";
6
- import { t as QueryClientConsumer } from "./QueryClientConsumer-BW1kmzJX.mjs";
5
+ import { t as QueriesHydration } from "./QueriesHydration-BeMkJU3l.mjs";
6
+ import { t as QueryClientConsumer } from "./QueryClientConsumer-DNkucS1e.mjs";
7
7
  import { n as UseSuspenseInfiniteQueryResult, r as useSuspenseInfiniteQuery, t as UseSuspenseInfiniteQueryOptions } from "./useSuspenseInfiniteQuery-Bh0nh8Kc.mjs";
8
- import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-B6hHnPDQ.mjs";
8
+ import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-CSd2Hyym.mjs";
9
9
  import { t as SuspenseQueries } from "./SuspenseQueries-CF_WoDIW.mjs";
10
10
  import { t as SuspenseQuery } from "./SuspenseQuery-BZ20Rsoo.mjs";
11
11
  import { t as createGetQueryClient } from "./createGetQueryClient-DTKVVwpJ.mjs";
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { t as usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery-CQSN-P
4
4
  import { t as PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery-RS3Qz-7B.mjs";
5
5
  import { t as usePrefetchQuery } from "./usePrefetchQuery-CtrJciA6.mjs";
6
6
  import { t as PrefetchQuery } from "./PrefetchQuery-uh4idoXK.mjs";
7
- import { t as QueriesHydration } from "./QueriesHydration-BrMSJHsz.mjs";
7
+ import { t as QueriesHydration } from "./QueriesHydration-27lFZeB8.mjs";
8
8
  import { t as QueryClientConsumer } from "./QueryClientConsumer-e7PyaFF3.mjs";
9
9
  import { t as SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery-DwW5I_M2.mjs";
10
10
  import { t as SuspenseQueries } from "./SuspenseQueries-C0mF_XD_.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suspensive/react-query-4",
3
- "version": "3.18.0",
3
+ "version": "3.19.1",
4
4
  "description": "Suspensive interfaces for @tanstack/react-query@4",
5
5
  "keywords": [
6
6
  "suspensive",
@@ -1,4 +1,4 @@
1
- import { QueryClient, dehydrate, infiniteQueryOptions } from '@tanstack/react-query'
1
+ import { QueryClient, QueryClientProvider, dehydrate, infiniteQueryOptions } from '@tanstack/react-query'
2
2
  import { render, screen } from '@testing-library/react'
3
3
  import type { ComponentProps, ReactNode } from 'react'
4
4
  import { describe, expect, it, vi } from 'vitest'
@@ -351,4 +351,41 @@ describe('<QueriesHydration/>', () => {
351
351
  pageParams: [undefined],
352
352
  })
353
353
  })
354
+
355
+ it('should timeout when query takes longer than the timeout', async () => {
356
+ const serverQueryClient = new QueryClient()
357
+ const timeoutMs = 100
358
+ const queryDelayMs = 200
359
+ const mockQueryFn = vi
360
+ .fn()
361
+ .mockImplementation(
362
+ () => new Promise((resolve) => setTimeout(() => resolve({ data: 'test-data' }), queryDelayMs))
363
+ )
364
+
365
+ const queries = [
366
+ {
367
+ queryKey: ['test-query'],
368
+ queryFn: mockQueryFn,
369
+ },
370
+ ]
371
+
372
+ const ClientChild = () => {
373
+ return <div>Client Child</div>
374
+ }
375
+
376
+ const result = await QueriesHydration({
377
+ queries,
378
+ queryClient: serverQueryClient,
379
+ timeout: timeoutMs,
380
+ children: <ClientChild />,
381
+ })
382
+
383
+ expect(mockQueryFn).toHaveBeenCalledTimes(1)
384
+ expect(screen.queryByText('Client Child')).not.toBeInTheDocument()
385
+
386
+ const clientQueryClient = new QueryClient()
387
+ render(<QueryClientProvider client={clientQueryClient}>{result}</QueryClientProvider>)
388
+ expect(screen.getByTestId('client-only')).toBeInTheDocument()
389
+ expect(screen.getByText('Client Child')).toBeInTheDocument()
390
+ })
354
391
  })
@@ -80,6 +80,7 @@ export async function QueriesHydration({
80
80
  children,
81
81
  queryClient = new QueryClient(),
82
82
  skipSsrOnError = true,
83
+ timeout,
83
84
  ...props
84
85
  }: {
85
86
  /**
@@ -105,14 +106,27 @@ export async function QueriesHydration({
105
106
  | {
106
107
  fallback: ReactNode
107
108
  }
109
+ /**
110
+ * The timeout in milliseconds for the query.
111
+ * If the query takes longer than the timeout, it will be considered as an error.
112
+ * When not set, no timeout is applied.
113
+ */
114
+ timeout?: number
108
115
  } & OmitKeyof<HydrateProps, 'state'>) {
116
+ const timeoutController =
117
+ timeout != null && timeout >= 0
118
+ ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`)
119
+ : undefined
109
120
  try {
110
- await Promise.all(
121
+ const queriesPromise = Promise.all(
111
122
  queries.map((query) =>
112
123
  'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)
113
124
  )
114
125
  )
126
+ await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)
127
+ timeoutController?.clear()
115
128
  } catch {
129
+ timeoutController?.clear()
116
130
  if (skipSsrOnError) {
117
131
  return (
118
132
  <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>
@@ -125,3 +139,13 @@ export async function QueriesHydration({
125
139
  </Hydrate>
126
140
  )
127
141
  }
142
+
143
+ const createTimeoutController = (ms: number, errorMessage: string) => {
144
+ let timerId: ReturnType<typeof setTimeout> | undefined
145
+ return {
146
+ promise: new Promise<never>((_, reject) => {
147
+ timerId = setTimeout(() => reject(new Error(errorMessage)), ms)
148
+ }),
149
+ clear: () => timerId != null && clearTimeout(timerId),
150
+ }
151
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueriesHydration-99AzKj29.d.cts","names":[],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AA6EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsB,gBAAA;;;;;;;;;;gBAUN;;;;;YAMV,aAAa,gDACb,aAAa;;;;;;;;cAWD;;IAEd,UAAU,yBAAsB,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueriesHydration-BARmyHJu.cjs","names":["QueryClient","ClientOnly","Hydrate"],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":["import {\n Hydrate,\n type HydrateProps,\n type OmitKeyof,\n QueryClient,\n type QueryOptions,\n type UseInfiniteQueryOptions,\n type WithRequired,\n dehydrate,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { ClientOnly } from './components/ClientOnly'\n\n/**\n * A server component that fetches multiple queries on the server and hydrates them to the client.\n *\n * @experimental This component is experimental and may be changed or removed in the future.\n *\n * @description\n * QueriesHydration is designed for React Server Components (RSC).\n * It pre-fetches multiple queries on the server side and automatically hydrates\n * the data to the client, enabling seamless data synchronization between server and client.\n *\n * When errors occur during server-side fetching, the component gracefully falls back\n * to client-side rendering, ensuring your application remains resilient.\n *\n * @example\n * ```tsx\n * // app/page.tsx (Server Component)\n * import { Suspense } from 'react'\n * import { QueriesHydration } from '@suspensive/react-query'\n * import { queryOptions } from '@tanstack/react-query'\n *\n * const userQueryOptions = (userId: string) => queryOptions({\n * queryKey: ['user', userId],\n * queryFn: () => fetchUser(userId)\n * })\n *\n * const postsQueryOptions = () => queryOptions({\n * queryKey: ['posts'],\n * queryFn: () => fetchPosts()\n * })\n *\n * export default function Page({ userId }: { userId: string }) {\n * return (\n * <>\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration queries={[userQueryOptions(userId)]}>\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n *\n * <Suspense fallback={<div>Loading posts...</div>}>\n * <QueriesHydration queries={[postsQueryOptions()]}>\n * <PostsList />\n * </QueriesHydration>\n * </Suspense>\n * </>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom error fallback\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration\n * queries={[userQueryOptions(userId)]}\n * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}\n * >\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n * ```\n *\n * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}\n */\nexport async function QueriesHydration({\n queries,\n children,\n queryClient = new QueryClient(),\n skipSsrOnError = true,\n ...props\n}: {\n /**\n * The QueryClient instance to use for fetching queries.\n */\n queryClient?: QueryClient\n /**\n * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.\n * You can mix regular queries and infinite queries in the same array.\n */\n queries: (\n | WithRequired<QueryOptions<any, any, any, any>, 'queryKey'>\n | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>\n )[]\n /**\n * Controls error handling behavior:\n * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails\n * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)\n * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering\n */\n skipSsrOnError?:\n | boolean\n | {\n fallback: ReactNode\n }\n} & OmitKeyof<HydrateProps, 'state'>) {\n try {\n await Promise.all(\n queries.map((query) =>\n 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)\n )\n )\n } catch {\n if (skipSsrOnError) {\n return (\n <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>\n )\n }\n }\n return (\n <Hydrate {...props} state={dehydrate(queryClient)}>\n {children}\n </Hydrate>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJF,SAAsB,iBAAiB;;;;wDA8BD;MA9BC,EACrC,SACA,UACA,cAAc,IAAIA,oCAAa,EAC/B,iBAAiB,eACd;AA0BH,MAAI;AACF,SAAM,QAAQ,IACZ,QAAQ,KAAK,UACX,sBAAsB,QAAQ,YAAY,mBAAmB,MAAM,GAAG,YAAY,WAAW,MAAM,CACpG,CACF;oBACK;AACN,OAAI,eACF,QACE,2CAACC;IAAW,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;KAAsB;;AAIlH,SACE,2CAACC,8GAAY;GAAO,6CAAiB,YAAY;GAC9C;KACO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueriesHydration-BrMSJHsz.mjs","names":[],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":["import {\n Hydrate,\n type HydrateProps,\n type OmitKeyof,\n QueryClient,\n type QueryOptions,\n type UseInfiniteQueryOptions,\n type WithRequired,\n dehydrate,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { ClientOnly } from './components/ClientOnly'\n\n/**\n * A server component that fetches multiple queries on the server and hydrates them to the client.\n *\n * @experimental This component is experimental and may be changed or removed in the future.\n *\n * @description\n * QueriesHydration is designed for React Server Components (RSC).\n * It pre-fetches multiple queries on the server side and automatically hydrates\n * the data to the client, enabling seamless data synchronization between server and client.\n *\n * When errors occur during server-side fetching, the component gracefully falls back\n * to client-side rendering, ensuring your application remains resilient.\n *\n * @example\n * ```tsx\n * // app/page.tsx (Server Component)\n * import { Suspense } from 'react'\n * import { QueriesHydration } from '@suspensive/react-query'\n * import { queryOptions } from '@tanstack/react-query'\n *\n * const userQueryOptions = (userId: string) => queryOptions({\n * queryKey: ['user', userId],\n * queryFn: () => fetchUser(userId)\n * })\n *\n * const postsQueryOptions = () => queryOptions({\n * queryKey: ['posts'],\n * queryFn: () => fetchPosts()\n * })\n *\n * export default function Page({ userId }: { userId: string }) {\n * return (\n * <>\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration queries={[userQueryOptions(userId)]}>\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n *\n * <Suspense fallback={<div>Loading posts...</div>}>\n * <QueriesHydration queries={[postsQueryOptions()]}>\n * <PostsList />\n * </QueriesHydration>\n * </Suspense>\n * </>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom error fallback\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration\n * queries={[userQueryOptions(userId)]}\n * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}\n * >\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n * ```\n *\n * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}\n */\nexport async function QueriesHydration({\n queries,\n children,\n queryClient = new QueryClient(),\n skipSsrOnError = true,\n ...props\n}: {\n /**\n * The QueryClient instance to use for fetching queries.\n */\n queryClient?: QueryClient\n /**\n * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.\n * You can mix regular queries and infinite queries in the same array.\n */\n queries: (\n | WithRequired<QueryOptions<any, any, any, any>, 'queryKey'>\n | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>\n )[]\n /**\n * Controls error handling behavior:\n * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails\n * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)\n * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering\n */\n skipSsrOnError?:\n | boolean\n | {\n fallback: ReactNode\n }\n} & OmitKeyof<HydrateProps, 'state'>) {\n try {\n await Promise.all(\n queries.map((query) =>\n 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)\n )\n )\n } catch {\n if (skipSsrOnError) {\n return (\n <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>\n )\n }\n }\n return (\n <Hydrate {...props} state={dehydrate(queryClient)}>\n {children}\n </Hydrate>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJF,SAAsB,iBAAiB;;;;wDA8BD;MA9BC,EACrC,SACA,UACA,cAAc,IAAI,aAAa,EAC/B,iBAAiB,eACd;AA0BH,MAAI;AACF,SAAM,QAAQ,IACZ,QAAQ,KAAK,UACX,sBAAsB,QAAQ,YAAY,mBAAmB,MAAM,GAAG,YAAY,WAAW,MAAM,CACpG,CACF;oBACK;AACN,OAAI,eACF,QACE,oBAAC;IAAW,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;KAAsB;;AAIlH,SACE,oBAAC,2CAAY;GAAO,OAAO,UAAU,YAAY;GAC9C;KACO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueriesHydration-M2zoVGgJ.d.mts","names":[],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AA6EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsB,gBAAA;;;;;;;;;;gBAUN;;;;;YAMV,aAAa,gDACb,aAAa;;;;;;;;cAWD;;IAEd,UAAU,yBAAsB,QAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}