@suspensive/react-query-4 3.19.3 → 3.19.5
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.
- package/dist/IsFetching.cjs +1 -1
- package/dist/IsFetching.cjs.map +1 -1
- package/dist/IsFetching.d.cts.map +1 -1
- package/dist/IsFetching.d.mts.map +1 -1
- package/dist/IsFetching.mjs +1 -1
- package/dist/IsFetching.mjs.map +1 -1
- package/dist/Mutation.cjs +1 -1
- package/dist/Mutation.cjs.map +1 -1
- package/dist/Mutation.d.cts.map +1 -1
- package/dist/Mutation.d.mts.map +1 -1
- package/dist/Mutation.mjs +1 -1
- package/dist/Mutation.mjs.map +1 -1
- package/dist/PrefetchInfiniteQuery.cjs.map +1 -1
- package/dist/PrefetchInfiniteQuery.d.cts.map +1 -1
- package/dist/PrefetchInfiniteQuery.d.mts.map +1 -1
- package/dist/PrefetchInfiniteQuery.mjs.map +1 -1
- package/dist/PrefetchQuery.cjs.map +1 -1
- package/dist/PrefetchQuery.d.cts.map +1 -1
- package/dist/PrefetchQuery.d.mts.map +1 -1
- package/dist/PrefetchQuery.mjs.map +1 -1
- package/dist/QueriesHydration.cjs +116 -2
- package/dist/QueriesHydration.cjs.map +1 -0
- package/dist/QueriesHydration.mjs +116 -2
- package/dist/QueriesHydration.mjs.map +1 -0
- package/dist/QueryClientConsumer.cjs.map +1 -1
- package/dist/QueryClientConsumer.d.cts.map +1 -1
- package/dist/QueryClientConsumer.d.mts.map +1 -1
- package/dist/QueryClientConsumer.mjs.map +1 -1
- package/dist/SuspenseInfiniteQuery.cjs +1 -1
- package/dist/SuspenseInfiniteQuery.cjs.map +1 -1
- package/dist/SuspenseInfiniteQuery.d.cts.map +1 -1
- package/dist/SuspenseInfiniteQuery.d.mts.map +1 -1
- package/dist/SuspenseInfiniteQuery.mjs +1 -1
- package/dist/SuspenseInfiniteQuery.mjs.map +1 -1
- package/dist/SuspenseQueries.cjs.map +1 -1
- package/dist/SuspenseQueries.d.cts.map +1 -1
- package/dist/SuspenseQueries.d.mts.map +1 -1
- package/dist/SuspenseQueries.mjs.map +1 -1
- package/dist/SuspenseQuery.cjs +1 -1
- package/dist/SuspenseQuery.cjs.map +1 -1
- package/dist/SuspenseQuery.d.cts.map +1 -1
- package/dist/SuspenseQuery.d.mts.map +1 -1
- package/dist/SuspenseQuery.mjs +1 -1
- package/dist/SuspenseQuery.mjs.map +1 -1
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.cjs +29 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.mjs +28 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.cjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs +15 -0
- package/dist/{objectWithoutProperties-CZk5Qmfh.mjs → _virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs} +2 -12
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.cjs +18 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.mjs +12 -0
- package/dist/components/ClientOnly.cjs +0 -1
- package/dist/components/ClientOnly.cjs.map +1 -1
- package/dist/components/ClientOnly.mjs.map +1 -1
- package/dist/createGetQueryClient.cjs +1 -1
- package/dist/createGetQueryClient.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/dist/usePrefetchInfiniteQuery.d.cts.map +1 -1
- package/dist/usePrefetchInfiniteQuery.d.mts.map +1 -1
- package/dist/usePrefetchInfiniteQuery.mjs.map +1 -1
- package/dist/usePrefetchQuery.cjs.map +1 -1
- package/dist/usePrefetchQuery.d.cts.map +1 -1
- package/dist/usePrefetchQuery.d.mts.map +1 -1
- package/dist/usePrefetchQuery.mjs.map +1 -1
- package/dist/useSuspenseInfiniteQuery.cjs.map +1 -1
- package/dist/useSuspenseInfiniteQuery.d.cts.map +1 -1
- package/dist/useSuspenseInfiniteQuery.d.mts.map +1 -1
- package/dist/useSuspenseInfiniteQuery.mjs.map +1 -1
- package/dist/useSuspenseQueries.cjs.map +1 -1
- package/dist/useSuspenseQueries.d.cts.map +1 -1
- package/dist/useSuspenseQueries.d.mts.map +1 -1
- package/dist/useSuspenseQueries.mjs.map +1 -1
- package/dist/useSuspenseQuery.cjs.map +1 -1
- package/dist/useSuspenseQuery.d.cts.map +1 -1
- package/dist/useSuspenseQuery.d.mts.map +1 -1
- package/dist/useSuspenseQuery.mjs.map +1 -1
- package/package.json +1 -1
- package/src/IsFetching.tsx +0 -1
- package/src/Mutation.tsx +0 -1
- package/src/PrefetchInfiniteQuery.tsx +0 -1
- package/src/PrefetchQuery.tsx +0 -1
- package/src/QueryClientConsumer.tsx +0 -1
- package/src/SuspenseInfiniteQuery.tsx +0 -1
- package/src/SuspenseQueries.tsx +0 -1
- package/src/SuspenseQuery.tsx +0 -1
- package/src/components/ClientOnly.tsx +0 -1
- package/src/usePrefetchInfiniteQuery.ts +0 -1
- package/src/usePrefetchQuery.ts +0 -1
- package/src/useSuspenseInfiniteQuery.ts +0 -1
- package/src/useSuspenseQueries.ts +0 -1
- package/src/useSuspenseQuery.ts +0 -1
- package/dist/QueriesHydration-B9tinfWA.cjs +0 -148
- package/dist/QueriesHydration-B9tinfWA.cjs.map +0 -1
- package/dist/QueriesHydration-MZQ7Oj60.mjs +0 -143
- package/dist/QueriesHydration-MZQ7Oj60.mjs.map +0 -1
- package/dist/components/ClientOnly.d.cts +0 -13
- package/dist/components/ClientOnly.d.cts.map +0 -1
- package/dist/components/ClientOnly.d.mts +0 -13
- package/dist/components/ClientOnly.d.mts.map +0 -1
- package/dist/objectSpread2-9HkiXZY2.cjs +0 -73
- package/dist/objectSpread2-BX3M3dlG.mjs +0 -67
- package/dist/objectWithoutProperties-CfjOeCpP.cjs +0 -31
package/dist/IsFetching.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_objectWithoutProperties = require('./
|
|
4
|
+
const require_objectWithoutProperties = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs');
|
|
5
5
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
|
package/dist/IsFetching.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsFetching.cjs","names":[],"sources":["../src/IsFetching.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"IsFetching.cjs","names":[],"sources":["../src/IsFetching.tsx"],"sourcesContent":["'use client'\nimport { type QueryFilters, useIsFetching } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\n/**\n * Renders the current fetching count for queries that match the given filters.\n * @experimental This is an experimental feature.\n */\nexport const IsFetching = ({\n children,\n ...filter\n}: QueryFilters & { children: (isFetching: ReturnType<typeof useIsFetching>) => ReactNode }) => (\n <>{children(useIsFetching(filter))}</>\n)\n"],"mappings":";;;;;;;;mBASE;;;;;AADF,MAAa,cAAc,SAGqE;KAHrE,EACzB;AAE8F,QAC9F,mFAAG,4HAA8B,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsFetching.d.cts","names":[],"sources":["../src/IsFetching.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"IsFetching.d.cts","names":[],"sources":["../src/IsFetching.tsx"],"mappings":";;;;;;;;AAQA;cAAa,UAAA;EAAc,QAAA;EAAA,GAAA;AAAA,GAGxB,YAAA;EAAiB,QAAA,GAAW,UAAA,EAAY,UAAA,QAAkB,aAAA,MAAmB,SAAA;AAAA,MAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsFetching.d.mts","names":[],"sources":["../src/IsFetching.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"IsFetching.d.mts","names":[],"sources":["../src/IsFetching.tsx"],"mappings":";;;;;;;;AAQA;cAAa,UAAA;EAAc,QAAA;EAAA,GAAA;AAAA,GAGxB,YAAA;EAAiB,QAAA,GAAW,UAAA,EAAY,UAAA,QAAkB,aAAA,MAAmB,SAAA;AAAA,MAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/IsFetching.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { _objectWithoutProperties } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs";
|
|
4
4
|
import { useIsFetching } from "@tanstack/react-query";
|
|
5
5
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
6
|
|
package/dist/IsFetching.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsFetching.mjs","names":[],"sources":["../src/IsFetching.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"IsFetching.mjs","names":[],"sources":["../src/IsFetching.tsx"],"sourcesContent":["'use client'\nimport { type QueryFilters, useIsFetching } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\n/**\n * Renders the current fetching count for queries that match the given filters.\n * @experimental This is an experimental feature.\n */\nexport const IsFetching = ({\n children,\n ...filter\n}: QueryFilters & { children: (isFetching: ReturnType<typeof useIsFetching>) => ReactNode }) => (\n <>{children(useIsFetching(filter))}</>\n)\n"],"mappings":";;;;;;;mBASE;;;;;AADF,MAAa,cAAc,SAGqE;KAHrE,EACzB;AAE8F,QAC9F,0CAAG,SAAS,wDAAqB,CAAC,EAAI"}
|
package/dist/Mutation.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_objectWithoutProperties = require('./
|
|
4
|
+
const require_objectWithoutProperties = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs');
|
|
5
5
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
|
package/dist/Mutation.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mutation.cjs","names":[],"sources":["../src/Mutation.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"Mutation.cjs","names":[],"sources":["../src/Mutation.tsx"],"sourcesContent":["'use client'\nimport { type UseMutationOptions, type UseMutationResult, useMutation } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\nexport function Mutation<TData = unknown, TError = unknown, TVariables = void, TContext = unknown>({\n children,\n ...options\n}: UseMutationOptions<TData, TError, TVariables, TContext> & {\n children: (mutationResult: UseMutationResult<TData, TError, TVariables, TContext>) => ReactNode\n}) {\n return <>{children(useMutation(options))}</>\n}\n"],"mappings":";;;;;;;;mBAKE;AADF,SAAgB,SAAmF,MAKhG;KALgG,EACjG;AAKA,QAAO,mFAAG,0HAA6B,CAAC,EAAI"}
|
package/dist/Mutation.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mutation.d.cts","names":[],"sources":["../src/Mutation.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Mutation.d.cts","names":[],"sources":["../src/Mutation.tsx"],"mappings":";;;;;iBAIgB,QAAA,0EAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,kBAAA,CAAmB,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,QAAA;EAC/C,QAAA,GAAW,cAAA,EAAgB,iBAAA,CAAkB,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,QAAA,MAAc,SAAA;AAAA,IACvF,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/Mutation.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mutation.d.mts","names":[],"sources":["../src/Mutation.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Mutation.d.mts","names":[],"sources":["../src/Mutation.tsx"],"mappings":";;;;;iBAIgB,QAAA,0EAAA,CAAA;EACd,QAAA;EAAA,GACG;AAAA,GACF,kBAAA,CAAmB,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,QAAA;EAC/C,QAAA,GAAW,cAAA,EAAgB,iBAAA,CAAkB,KAAA,EAAO,MAAA,EAAQ,UAAA,EAAY,QAAA,MAAc,SAAA;AAAA,IACvF,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/Mutation.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { _objectWithoutProperties } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs";
|
|
4
4
|
import { useMutation } from "@tanstack/react-query";
|
|
5
5
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
6
|
|
package/dist/Mutation.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mutation.mjs","names":[],"sources":["../src/Mutation.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"Mutation.mjs","names":[],"sources":["../src/Mutation.tsx"],"sourcesContent":["'use client'\nimport { type UseMutationOptions, type UseMutationResult, useMutation } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\nexport function Mutation<TData = unknown, TError = unknown, TVariables = void, TContext = unknown>({\n children,\n ...options\n}: UseMutationOptions<TData, TError, TVariables, TContext> & {\n children: (mutationResult: UseMutationResult<TData, TError, TVariables, TContext>) => ReactNode\n}) {\n return <>{children(useMutation(options))}</>\n}\n"],"mappings":";;;;;;;mBAKE;AADF,SAAgB,SAAmF,MAKhG;KALgG,EACjG;AAKA,QAAO,0CAAG,SAAS,sDAAoB,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchInfiniteQuery.cjs","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.cjs","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":["'use client'\nimport { type FetchInfiniteQueryOptions, type QueryKey } from '@tanstack/react-query'\nimport { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'\n\n/**\n * A component that allows you to use `usePrefetchInfiniteQuery` in JSX, avoiding the limitations of React hooks.\n * @see {@link https://suspensive.org/docs/react-query/PrefetchInfiniteQuery Suspensive Docs}\n * @example\n * ```tsx\n * <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />\n * ```\n */\nexport function PrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>) {\n usePrefetchInfiniteQuery(options)\n return <></>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,SAAgB,sBAKd,SAA4E;AAC5E,2DAAyB,QAAQ;AACjC,QAAO,yEAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchInfiniteQuery.d.cts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.d.cts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"mappings":";;;;;;;AAYA;;;;;iBAAgB,qBAAA,mDAGN,YAAA,oBACU,QAAA,GAAW,QAAA,CAAA,CAC7B,OAAA,EAAS,yBAAA,CAA0B,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchInfiniteQuery.d.mts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.d.mts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"mappings":";;;;;;;AAYA;;;;;iBAAgB,qBAAA,mDAGN,YAAA,oBACU,QAAA,GAAW,QAAA,CAAA,CAC7B,OAAA,EAAS,yBAAA,CAA0B,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchInfiniteQuery.mjs","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.mjs","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":["'use client'\nimport { type FetchInfiniteQueryOptions, type QueryKey } from '@tanstack/react-query'\nimport { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'\n\n/**\n * A component that allows you to use `usePrefetchInfiniteQuery` in JSX, avoiding the limitations of React hooks.\n * @see {@link https://suspensive.org/docs/react-query/PrefetchInfiniteQuery Suspensive Docs}\n * @example\n * ```tsx\n * <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />\n * ```\n */\nexport function PrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>) {\n usePrefetchInfiniteQuery(options)\n return <></>\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,sBAKd,SAA4E;AAC5E,0BAAyB,QAAQ;AACjC,QAAO,gCAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchQuery.cjs","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.cjs","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":["'use client'\nimport { type FetchQueryOptions, type QueryKey } from '@tanstack/react-query'\nimport { usePrefetchQuery } from './usePrefetchQuery'\n\n/**\n * A component that allows you to use usePrefetchQuery in JSX, avoiding the limitations of React hooks.\n * @see {@link https://suspensive.org/docs/react-query/PrefetchQuery Suspensive Docs}\n * @example\n * ```tsx\n * <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />\n * ```\n */\nexport function PrefetchQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>) {\n usePrefetchQuery(options)\n return <></>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,SAAgB,cAKd,SAAoE;AACpE,2CAAiB,QAAQ;AACzB,QAAO,yEAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchQuery.d.cts","names":[],"sources":["../src/PrefetchQuery.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.d.cts","names":[],"sources":["../src/PrefetchQuery.tsx"],"mappings":";;;;;;;AAYA;;;;;iBAAgB,aAAA,mDAGN,YAAA,oBACU,QAAA,GAAW,QAAA,CAAA,CAC7B,OAAA,EAAS,iBAAA,CAAkB,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchQuery.d.mts","names":[],"sources":["../src/PrefetchQuery.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.d.mts","names":[],"sources":["../src/PrefetchQuery.tsx"],"mappings":";;;;;;;AAYA;;;;;iBAAgB,aAAA,mDAGN,YAAA,oBACU,QAAA,GAAW,QAAA,CAAA,CAC7B,OAAA,EAAS,iBAAA,CAAkB,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefetchQuery.mjs","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.mjs","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":["'use client'\nimport { type FetchQueryOptions, type QueryKey } from '@tanstack/react-query'\nimport { usePrefetchQuery } from './usePrefetchQuery'\n\n/**\n * A component that allows you to use usePrefetchQuery in JSX, avoiding the limitations of React hooks.\n * @see {@link https://suspensive.org/docs/react-query/PrefetchQuery Suspensive Docs}\n * @example\n * ```tsx\n * <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />\n * ```\n */\nexport function PrefetchQuery<\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>) {\n usePrefetchQuery(options)\n return <></>\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,cAKd,SAAoE;AACpE,kBAAiB,QAAQ;AACzB,QAAO,gCAAK"}
|
|
@@ -1,4 +1,118 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
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");
|
|
3
8
|
|
|
4
|
-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueriesHydration.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 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;;;;iFAqCD;MArCC,EACrC,SACA,UACA,cAAc,IAAIA,mCAAa,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,+BAAD;IAAY,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;IAAsB;;AAIlH,SACE,2CAACC,6GAAY;GAAO,4CAAiB,YAAY;GAC9C;IACO;;;;AAId,MAAM,2BAA2B,IAAY,iBAAyB;CACpE,IAAI;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,3 +1,117 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
2
7
|
|
|
3
|
-
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueriesHydration.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 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,YAAD;IAAY,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;IAAsB;;AAIlH,SACE,oBAAC,2CAAY;GAAO,OAAO,UAAU,YAAY;GAC9C;IACO;;;;AAId,MAAM,2BAA2B,IAAY,iBAAyB;CACpE,IAAI;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientConsumer.cjs","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"QueryClientConsumer.cjs","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":["'use client'\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":";;;;;;;;;;AAOA,SAAgB,oBAAoB,EAClC,UACA,WAIC;AACD,QAAO,mFAAG,mDAAwB,EAAW,SAAgB,CAAC,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientConsumer.d.cts","names":[],"sources":["../src/QueryClientConsumer.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"QueryClientConsumer.d.cts","names":[],"sources":["../src/QueryClientConsumer.tsx"],"mappings":";;;;;;;;iBAOgB,mBAAA,CAAA;EACd,QAAA;EACA;AAAA;EAEA,QAAA,GAAW,WAAA,EAAa,WAAA,KAAgB,SAAA;EACxC,OAAA,GAAU,OAAA,CAAQ,WAAA;AAAA,IACnB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientConsumer.d.mts","names":[],"sources":["../src/QueryClientConsumer.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"QueryClientConsumer.d.mts","names":[],"sources":["../src/QueryClientConsumer.tsx"],"mappings":";;;;;;;;iBAOgB,mBAAA,CAAA;EACd,QAAA;EACA;AAAA;EAEA,QAAA,GAAW,WAAA,EAAa,WAAA,KAAgB,SAAA;EACxC,OAAA,GAAU,OAAA,CAAQ,WAAA;AAAA,IACnB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryClientConsumer.mjs","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"QueryClientConsumer.mjs","names":[],"sources":["../src/QueryClientConsumer.tsx"],"sourcesContent":["'use client'\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":";;;;;;;;;AAOA,SAAgB,oBAAoB,EAClC,UACA,WAIC;AACD,QAAO,0CAAG,SAAS,eAAe,EAAW,SAAgB,CAAC,CAAC,EAAI"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_objectWithoutProperties = require('./
|
|
4
|
+
const require_objectWithoutProperties = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs');
|
|
5
5
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseInfiniteQuery.cjs","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"SuspenseInfiniteQuery.cjs","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":["'use client'\nimport { type QueryKey, type UseSuspenseInfiniteQueryResult, useSuspenseInfiniteQuery } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { type UseSuspenseInfiniteQueryOptions } from './useSuspenseInfiniteQuery'\n/**\n * We provide these components to clearly express what causes suspense at the same depth.\n * `<SuspenseInfiniteQuery/>` serves to make `useSuspenseInfiniteQuery` easier to use in jsx.\n * @see {@link https://suspensive.org/docs/react-query/SuspenseInfiniteQuery Suspensive Docs}\n * @example\n * ```tsx\n * import { SuspenseInfiniteQuery } from '@suspensive/react-query'\n *\n * // You can use infiniteQueryOptions as props.\n * <SuspenseInfiniteQuery {...infiniteQueryOptions()}>\n * {({ data, fetchNextPage }) => {\n * return <></>\n * }}\n * </SuspenseInfiniteQuery>\n * ```\n */\nexport const SuspenseInfiniteQuery = <\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>({\n children,\n ...options\n}: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n children: (query: UseSuspenseInfiniteQueryResult<TData, TError>) => ReactNode\n}) => <>{children(useSuspenseInfiniteQuery(options))}</>\n"],"mappings":";;;;;;;;mBA0BE;;;;;;;;;;;;;;;;;AANF,MAAa,yBAKX,SAKI;KALJ,EACA;AAII,2FAAG,uIAA0C,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseInfiniteQuery.d.cts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuspenseInfiniteQuery.d.cts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"mappings":";;;;;;;;;AAoBA;;;;;;;;;;;;;cAAa,qBAAA,qDAGH,YAAA,oBACU,QAAA,GAAW,QAAA;EAC7B,QAAA;EAAA,GAAA;AAAA,GAGC,+BAAA,CAAgC,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA;EAC9D,QAAA,GAAW,KAAA,EAAO,8BAAA,CAA+B,KAAA,EAAO,MAAA,MAAY,SAAA;AAAA,MACrE,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseInfiniteQuery.d.mts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuspenseInfiniteQuery.d.mts","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"mappings":";;;;;;;;;AAoBA;;;;;;;;;;;;;cAAa,qBAAA,qDAGH,YAAA,oBACU,QAAA,GAAW,QAAA;EAC7B,QAAA;EAAA,GAAA;AAAA,GAGC,+BAAA,CAAgC,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA;EAC9D,QAAA,GAAW,KAAA,EAAO,8BAAA,CAA+B,KAAA,EAAO,MAAA,MAAY,SAAA;AAAA,MACrE,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { _objectWithoutProperties } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs";
|
|
4
4
|
import { useSuspenseInfiniteQuery } from "@tanstack/react-query";
|
|
5
5
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseInfiniteQuery.mjs","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"SuspenseInfiniteQuery.mjs","names":[],"sources":["../src/SuspenseInfiniteQuery.tsx"],"sourcesContent":["'use client'\nimport { type QueryKey, type UseSuspenseInfiniteQueryResult, useSuspenseInfiniteQuery } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { type UseSuspenseInfiniteQueryOptions } from './useSuspenseInfiniteQuery'\n/**\n * We provide these components to clearly express what causes suspense at the same depth.\n * `<SuspenseInfiniteQuery/>` serves to make `useSuspenseInfiniteQuery` easier to use in jsx.\n * @see {@link https://suspensive.org/docs/react-query/SuspenseInfiniteQuery Suspensive Docs}\n * @example\n * ```tsx\n * import { SuspenseInfiniteQuery } from '@suspensive/react-query'\n *\n * // You can use infiniteQueryOptions as props.\n * <SuspenseInfiniteQuery {...infiniteQueryOptions()}>\n * {({ data, fetchNextPage }) => {\n * return <></>\n * }}\n * </SuspenseInfiniteQuery>\n * ```\n */\nexport const SuspenseInfiniteQuery = <\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>({\n children,\n ...options\n}: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n children: (query: UseSuspenseInfiniteQueryResult<TData, TError>) => ReactNode\n}) => <>{children(useSuspenseInfiniteQuery(options))}</>\n"],"mappings":";;;;;;;mBA0BE;;;;;;;;;;;;;;;;;AANF,MAAa,yBAKX,SAKI;KALJ,EACA;AAII,kDAAG,SAAS,mEAAiC,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQueries.cjs","names":[],"sources":["../src/SuspenseQueries.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"SuspenseQueries.cjs","names":[],"sources":["../src/SuspenseQueries.tsx"],"sourcesContent":["'use client'\nimport { type SuspenseQueriesOptions, type SuspenseQueriesResults, useSuspenseQueries } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\n/**\n * We provide these components to clearly express what causes suspense at the same depth.\n * `<SuspenseQueries/>` serves to make `useSuspenseQueries` easier to use in jsx.\n * @see {@link https://suspensive.org/docs/react-query/SuspenseQueries Suspensive Docs}\n * @example\n * ```tsx\n * import { SuspenseQueries } from '@suspensive/react-query'\n *\n * <SuspenseQueries queries={[firstQueryOptions(), secondQueryOptions()]}>\n * {([{ data: firstQueryData }, { data: secondQueryData }]) => {\n * return <></>\n * }}\n * </SuspenseQueries>\n * ```\n */\nexport function SuspenseQueries<T extends any[]>({\n children,\n queries,\n}: {\n queries: readonly [...SuspenseQueriesOptions<T>]\n children: (queries: SuspenseQueriesResults<T>) => ReactNode\n}) {\n return <>{children(useSuspenseQueries({ queries }))}</>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,gBAAiC,EAC/C,UACA,WAIC;AACD,QAAO,mFAAG,uDAA4B,EAAE,SAAS,CAAC,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQueries.d.cts","names":[],"sources":["../src/SuspenseQueries.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuspenseQueries.d.cts","names":[],"sources":["../src/SuspenseQueries.tsx"],"mappings":";;;;;;;;AAmBA;;;;;;;;;;;;iBAAgB,eAAA,iBAAA,CAAA;EACd,QAAA;EACA;AAAA;EAEA,OAAA,eAAsB,sBAAA,CAAuB,CAAA;EAC7C,QAAA,GAAW,OAAA,EAAS,sBAAA,CAAuB,CAAA,MAAO,SAAA;AAAA,IACnD,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQueries.d.mts","names":[],"sources":["../src/SuspenseQueries.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuspenseQueries.d.mts","names":[],"sources":["../src/SuspenseQueries.tsx"],"mappings":";;;;;;;;AAmBA;;;;;;;;;;;;iBAAgB,eAAA,iBAAA,CAAA;EACd,QAAA;EACA;AAAA;EAEA,OAAA,eAAsB,sBAAA,CAAuB,CAAA;EAC7C,QAAA,GAAW,OAAA,EAAS,sBAAA,CAAuB,CAAA,MAAO,SAAA;AAAA,IACnD,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQueries.mjs","names":[],"sources":["../src/SuspenseQueries.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"SuspenseQueries.mjs","names":[],"sources":["../src/SuspenseQueries.tsx"],"sourcesContent":["'use client'\nimport { type SuspenseQueriesOptions, type SuspenseQueriesResults, useSuspenseQueries } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\n/**\n * We provide these components to clearly express what causes suspense at the same depth.\n * `<SuspenseQueries/>` serves to make `useSuspenseQueries` easier to use in jsx.\n * @see {@link https://suspensive.org/docs/react-query/SuspenseQueries Suspensive Docs}\n * @example\n * ```tsx\n * import { SuspenseQueries } from '@suspensive/react-query'\n *\n * <SuspenseQueries queries={[firstQueryOptions(), secondQueryOptions()]}>\n * {([{ data: firstQueryData }, { data: secondQueryData }]) => {\n * return <></>\n * }}\n * </SuspenseQueries>\n * ```\n */\nexport function SuspenseQueries<T extends any[]>({\n children,\n queries,\n}: {\n queries: readonly [...SuspenseQueriesOptions<T>]\n children: (queries: SuspenseQueriesResults<T>) => ReactNode\n}) {\n return <>{children(useSuspenseQueries({ queries }))}</>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,gBAAiC,EAC/C,UACA,WAIC;AACD,QAAO,0CAAG,SAAS,mBAAmB,EAAE,SAAS,CAAC,CAAC,EAAI"}
|
package/dist/SuspenseQuery.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_objectWithoutProperties = require('./
|
|
4
|
+
const require_objectWithoutProperties = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs');
|
|
5
5
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQuery.cjs","names":[],"sources":["../src/SuspenseQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"SuspenseQuery.cjs","names":[],"sources":["../src/SuspenseQuery.tsx"],"sourcesContent":["'use client'\nimport {\n type QueryKey,\n type UseSuspenseQueryOptions,\n type UseSuspenseQueryResult,\n useSuspenseQuery,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\n/**\n * We provide these components to clearly express what causes suspense at the same depth.\n * `<SuspenseQuery/>` serves to make `useSuspenseQuery` easier to use in jsx.\n * @see {@link https://suspensive.org/docs/react-query/SuspenseQuery Suspensive Docs}\n * @example\n * ```tsx\n * import { SuspenseQuery } from '@suspensive/react-query'\n *\n * // You can use QueryOptions as props.\n * <SuspenseQuery {...queryOptions()}>\n * {({ data, isLoading }) => {\n * return <></>\n * }\n * </SuspenseQuery>\n * ```\n */\nexport const SuspenseQuery = <\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>({\n children,\n ...options\n}: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n children: (queryResult: UseSuspenseQueryResult<TData, TError>) => ReactNode\n}) => <>{children(useSuspenseQuery(options))}</>\n"],"mappings":";;;;;;;;mBA+BE;;;;;;;;;;;;;;;;;AANF,MAAa,iBAKX,SAKI;KALJ,EACA;AAII,2FAAG,+HAAkC,CAAC,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQuery.d.cts","names":[],"sources":["../src/SuspenseQuery.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuspenseQuery.d.cts","names":[],"sources":["../src/SuspenseQuery.tsx"],"mappings":";;;;;;;;AAyBA;;;;;;;;;;;;;cAAa,aAAA,qDAGH,YAAA,oBACU,QAAA,GAAW,QAAA;EAC7B,QAAA;EAAA,GAAA;AAAA,GAGC,uBAAA,CAAwB,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA;EACtD,QAAA,GAAW,WAAA,EAAa,sBAAA,CAAuB,KAAA,EAAO,MAAA,MAAY,SAAA;AAAA,MACnE,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQuery.d.mts","names":[],"sources":["../src/SuspenseQuery.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuspenseQuery.d.mts","names":[],"sources":["../src/SuspenseQuery.tsx"],"mappings":";;;;;;;;AAyBA;;;;;;;;;;;;;cAAa,aAAA,qDAGH,YAAA,oBACU,QAAA,GAAW,QAAA;EAC7B,QAAA;EAAA,GAAA;AAAA,GAGC,uBAAA,CAAwB,YAAA,EAAc,MAAA,EAAQ,KAAA,EAAO,SAAA;EACtD,QAAA,GAAW,WAAA,EAAa,sBAAA,CAAuB,KAAA,EAAO,MAAA,MAAY,SAAA;AAAA,MACnE,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/SuspenseQuery.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { _objectWithoutProperties } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs";
|
|
4
4
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
5
5
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseQuery.mjs","names":[],"sources":["../src/SuspenseQuery.tsx"],"sourcesContent":["'use client'\
|
|
1
|
+
{"version":3,"file":"SuspenseQuery.mjs","names":[],"sources":["../src/SuspenseQuery.tsx"],"sourcesContent":["'use client'\nimport {\n type QueryKey,\n type UseSuspenseQueryOptions,\n type UseSuspenseQueryResult,\n useSuspenseQuery,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\n\n/**\n * We provide these components to clearly express what causes suspense at the same depth.\n * `<SuspenseQuery/>` serves to make `useSuspenseQuery` easier to use in jsx.\n * @see {@link https://suspensive.org/docs/react-query/SuspenseQuery Suspensive Docs}\n * @example\n * ```tsx\n * import { SuspenseQuery } from '@suspensive/react-query'\n *\n * // You can use QueryOptions as props.\n * <SuspenseQuery {...queryOptions()}>\n * {({ data, isLoading }) => {\n * return <></>\n * }\n * </SuspenseQuery>\n * ```\n */\nexport const SuspenseQuery = <\n TQueryFnData = unknown,\n TError = unknown,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>({\n children,\n ...options\n}: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n children: (queryResult: UseSuspenseQueryResult<TData, TError>) => ReactNode\n}) => <>{children(useSuspenseQuery(options))}</>\n"],"mappings":";;;;;;;mBA+BE;;;;;;;;;;;;;;;;;AANF,MAAa,iBAKX,SAKI;KALJ,EACA;AAII,kDAAG,SAAS,2DAAyB,CAAC,EAAI"}
|