@suspensive/react-query-4 3.19.1 → 3.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IsFetching.cjs +18 -2
- package/dist/IsFetching.cjs.map +1 -0
- package/dist/IsFetching.d.cts +18 -2
- package/dist/IsFetching.d.cts.map +1 -0
- package/dist/IsFetching.d.mts +18 -2
- package/dist/IsFetching.d.mts.map +1 -0
- package/dist/IsFetching.mjs +17 -2
- package/dist/IsFetching.mjs.map +1 -0
- package/dist/Mutation.cjs +14 -2
- package/dist/Mutation.cjs.map +1 -0
- package/dist/Mutation.d.cts +14 -2
- package/dist/Mutation.d.cts.map +1 -0
- package/dist/Mutation.d.mts +14 -2
- package/dist/Mutation.d.mts.map +1 -0
- package/dist/Mutation.mjs +13 -2
- package/dist/Mutation.mjs.map +1 -0
- package/dist/PrefetchInfiniteQuery.cjs +20 -2
- package/dist/PrefetchInfiniteQuery.cjs.map +1 -0
- package/dist/PrefetchInfiniteQuery.d.cts +16 -2
- package/dist/PrefetchInfiniteQuery.d.cts.map +1 -0
- package/dist/PrefetchInfiniteQuery.d.mts +16 -2
- package/dist/PrefetchInfiniteQuery.d.mts.map +1 -0
- package/dist/PrefetchInfiniteQuery.mjs +19 -2
- package/dist/PrefetchInfiniteQuery.mjs.map +1 -0
- package/dist/PrefetchQuery.cjs +20 -2
- package/dist/PrefetchQuery.cjs.map +1 -0
- package/dist/PrefetchQuery.d.cts +16 -2
- package/dist/PrefetchQuery.d.cts.map +1 -0
- package/dist/PrefetchQuery.d.mts +16 -2
- package/dist/PrefetchQuery.d.mts.map +1 -0
- package/dist/PrefetchQuery.mjs +19 -2
- package/dist/PrefetchQuery.mjs.map +1 -0
- package/dist/{QueriesHydration-BYKU-Mte.cjs → QueriesHydration-B9tinfWA.cjs} +16 -16
- package/dist/QueriesHydration-B9tinfWA.cjs.map +1 -0
- package/dist/{QueriesHydration-27lFZeB8.mjs → QueriesHydration-MZQ7Oj60.mjs} +11 -11
- package/dist/QueriesHydration-MZQ7Oj60.mjs.map +1 -0
- package/dist/QueriesHydration.cjs +2 -1
- package/dist/QueriesHydration.d.cts +105 -2
- package/dist/QueriesHydration.d.cts.map +1 -0
- package/dist/QueriesHydration.d.mts +105 -2
- package/dist/QueriesHydration.d.mts.map +1 -0
- package/dist/QueriesHydration.mjs +1 -1
- package/dist/QueryClientConsumer.cjs +14 -2
- package/dist/QueryClientConsumer.cjs.map +1 -0
- package/dist/QueryClientConsumer.d.cts +18 -2
- package/dist/QueryClientConsumer.d.cts.map +1 -0
- package/dist/QueryClientConsumer.d.mts +18 -2
- package/dist/QueryClientConsumer.d.mts.map +1 -0
- package/dist/QueryClientConsumer.mjs +13 -2
- package/dist/QueryClientConsumer.mjs.map +1 -0
- package/dist/SuspenseInfiniteQuery.cjs +30 -2
- package/dist/SuspenseInfiniteQuery.cjs.map +1 -0
- package/dist/SuspenseInfiniteQuery.d.cts +31 -2
- package/dist/SuspenseInfiniteQuery.d.cts.map +1 -0
- package/dist/SuspenseInfiniteQuery.d.mts +31 -3
- package/dist/SuspenseInfiniteQuery.d.mts.map +1 -0
- package/dist/SuspenseInfiniteQuery.mjs +29 -2
- package/dist/SuspenseInfiniteQuery.mjs.map +1 -0
- package/dist/SuspenseQueries.cjs +26 -2
- package/dist/SuspenseQueries.cjs.map +1 -0
- package/dist/SuspenseQueries.d.cts +30 -2
- package/dist/SuspenseQueries.d.cts.map +1 -0
- package/dist/SuspenseQueries.d.mts +30 -2
- package/dist/SuspenseQueries.d.mts.map +1 -0
- package/dist/SuspenseQueries.mjs +25 -2
- package/dist/SuspenseQueries.mjs.map +1 -0
- package/dist/SuspenseQuery.cjs +30 -2
- package/dist/SuspenseQuery.cjs.map +1 -0
- package/dist/SuspenseQuery.d.cts +30 -2
- package/dist/SuspenseQuery.d.cts.map +1 -0
- package/dist/SuspenseQuery.d.mts +30 -2
- package/dist/SuspenseQuery.d.mts.map +1 -0
- package/dist/SuspenseQuery.mjs +29 -2
- package/dist/SuspenseQuery.mjs.map +1 -0
- package/dist/components/ClientOnly.cjs +13 -2
- package/dist/components/ClientOnly.cjs.map +1 -0
- package/dist/components/ClientOnly.d.cts +2 -2
- package/dist/components/ClientOnly.d.cts.map +1 -1
- package/dist/components/ClientOnly.d.mts +2 -2
- package/dist/components/ClientOnly.d.mts.map +1 -1
- package/dist/components/ClientOnly.mjs +12 -2
- package/dist/components/ClientOnly.mjs.map +1 -0
- package/dist/createGetQueryClient.cjs +63 -2
- package/dist/createGetQueryClient.cjs.map +1 -0
- package/dist/createGetQueryClient.d.cts +53 -2
- package/dist/createGetQueryClient.d.cts.map +1 -0
- package/dist/createGetQueryClient.d.mts +53 -2
- package/dist/createGetQueryClient.d.mts.map +1 -0
- package/dist/createGetQueryClient.mjs +62 -2
- package/dist/createGetQueryClient.mjs.map +1 -0
- package/dist/index.cjs +19 -18
- package/dist/index.d.cts +18 -18
- package/dist/index.d.mts +18 -18
- package/dist/index.mjs +18 -18
- package/dist/infiniteQueryOptions.cjs +17 -2
- package/dist/infiniteQueryOptions.cjs.map +1 -0
- package/dist/infiniteQueryOptions.d.cts +28 -2
- package/dist/infiniteQueryOptions.d.cts.map +1 -0
- package/dist/infiniteQueryOptions.d.mts +28 -2
- package/dist/infiniteQueryOptions.d.mts.map +1 -0
- package/dist/infiniteQueryOptions.mjs +16 -2
- package/dist/infiniteQueryOptions.mjs.map +1 -0
- package/dist/mutationOptions.cjs +9 -2
- package/dist/mutationOptions.cjs.map +1 -0
- package/dist/mutationOptions.d.cts +7 -2
- package/dist/mutationOptions.d.cts.map +1 -0
- package/dist/mutationOptions.d.mts +7 -2
- package/dist/mutationOptions.d.mts.map +1 -0
- package/dist/mutationOptions.mjs +7 -2
- package/dist/mutationOptions.mjs.map +1 -0
- package/dist/{objectSpread2-CpqxxdM2.cjs → objectSpread2-9HkiXZY2.cjs} +15 -15
- package/dist/{objectSpread2-BFPIJj0i.mjs → objectSpread2-BX3M3dlG.mjs} +15 -15
- package/dist/{objectWithoutProperties-Drlt06jT.mjs → objectWithoutProperties-CZk5Qmfh.mjs} +2 -2
- package/dist/{objectWithoutProperties-BqF6LYLG.cjs → objectWithoutProperties-CfjOeCpP.cjs} +2 -2
- package/dist/queryOptions.cjs +17 -2
- package/dist/queryOptions.cjs.map +1 -0
- package/dist/queryOptions.d.cts +28 -2
- package/dist/queryOptions.d.cts.map +1 -0
- package/dist/queryOptions.d.mts +28 -2
- package/dist/queryOptions.d.mts.map +1 -0
- package/dist/queryOptions.mjs +16 -2
- package/dist/queryOptions.mjs.map +1 -0
- package/dist/usePrefetchInfiniteQuery.cjs +15 -2
- package/dist/usePrefetchInfiniteQuery.cjs.map +1 -0
- package/dist/usePrefetchInfiniteQuery.d.cts +11 -2
- package/dist/usePrefetchInfiniteQuery.d.cts.map +1 -0
- package/dist/usePrefetchInfiniteQuery.d.mts +11 -2
- package/dist/usePrefetchInfiniteQuery.d.mts.map +1 -0
- package/dist/usePrefetchInfiniteQuery.mjs +14 -2
- package/dist/usePrefetchInfiniteQuery.mjs.map +1 -0
- package/dist/usePrefetchQuery.cjs +15 -2
- package/dist/usePrefetchQuery.cjs.map +1 -0
- package/dist/usePrefetchQuery.d.cts +11 -2
- package/dist/usePrefetchQuery.d.cts.map +1 -0
- package/dist/usePrefetchQuery.d.mts +11 -2
- package/dist/usePrefetchQuery.d.mts.map +1 -0
- package/dist/usePrefetchQuery.mjs +14 -2
- package/dist/usePrefetchQuery.mjs.map +1 -0
- package/dist/useSuspenseInfiniteQuery.cjs +17 -2
- package/dist/useSuspenseInfiniteQuery.cjs.map +1 -0
- package/dist/useSuspenseInfiniteQuery.d.cts +17 -2
- package/dist/useSuspenseInfiniteQuery.d.cts.map +1 -0
- package/dist/useSuspenseInfiniteQuery.d.mts +17 -2
- package/dist/useSuspenseInfiniteQuery.d.mts.map +1 -0
- package/dist/useSuspenseInfiniteQuery.mjs +16 -2
- package/dist/useSuspenseInfiniteQuery.mjs.map +1 -0
- package/dist/useSuspenseQueries.cjs +17 -2
- package/dist/useSuspenseQueries.cjs.map +1 -0
- package/dist/useSuspenseQueries.d.cts +36 -2
- package/dist/useSuspenseQueries.d.cts.map +1 -0
- package/dist/useSuspenseQueries.d.mts +36 -2
- package/dist/useSuspenseQueries.d.mts.map +1 -0
- package/dist/useSuspenseQueries.mjs +16 -2
- package/dist/useSuspenseQueries.mjs.map +1 -0
- package/dist/useSuspenseQuery.cjs +17 -2
- package/dist/useSuspenseQuery.cjs.map +1 -0
- package/dist/useSuspenseQuery.d.cts +36 -2
- package/dist/useSuspenseQuery.d.cts.map +1 -0
- package/dist/useSuspenseQuery.d.mts +36 -2
- package/dist/useSuspenseQuery.d.mts.map +1 -0
- package/dist/useSuspenseQuery.mjs +16 -2
- package/dist/useSuspenseQuery.mjs.map +1 -0
- package/package.json +4 -4
- package/src/IsFetching.spec.tsx +34 -0
- package/src/IsFetching.tsx +3 -1
- package/src/createGetQueryClient.spec.tsx +25 -77
- package/dist/ClientOnly-BdmzVYnI.mjs +0 -15
- package/dist/ClientOnly-BdmzVYnI.mjs.map +0 -1
- package/dist/ClientOnly-Dvf8t__-.cjs +0 -20
- package/dist/ClientOnly-Dvf8t__-.cjs.map +0 -1
- package/dist/IsFetching-94upYqWP.mjs +0 -12
- package/dist/IsFetching-94upYqWP.mjs.map +0 -1
- package/dist/IsFetching-BGIRMA6C.cjs +0 -17
- package/dist/IsFetching-BGIRMA6C.cjs.map +0 -1
- package/dist/IsFetching-CThOxeZB.d.cts +0 -16
- package/dist/IsFetching-CThOxeZB.d.cts.map +0 -1
- package/dist/IsFetching-D3xmE2Kn.d.mts +0 -16
- package/dist/IsFetching-D3xmE2Kn.d.mts.map +0 -1
- package/dist/Mutation-BJunfaUO.mjs +0 -14
- package/dist/Mutation-BJunfaUO.mjs.map +0 -1
- package/dist/Mutation-BWER242k.cjs +0 -19
- package/dist/Mutation-BWER242k.cjs.map +0 -1
- package/dist/Mutation-CGpbCg54.d.mts +0 -14
- package/dist/Mutation-CGpbCg54.d.mts.map +0 -1
- package/dist/Mutation-Dt5kUsd8.d.cts +0 -14
- package/dist/Mutation-Dt5kUsd8.d.cts.map +0 -1
- package/dist/PrefetchInfiniteQuery-DgZfL2Sb.d.cts +0 -17
- package/dist/PrefetchInfiniteQuery-DgZfL2Sb.d.cts.map +0 -1
- package/dist/PrefetchInfiniteQuery-Dzjm5lf8.d.mts +0 -17
- package/dist/PrefetchInfiniteQuery-Dzjm5lf8.d.mts.map +0 -1
- package/dist/PrefetchInfiniteQuery-RS3Qz-7B.mjs +0 -20
- package/dist/PrefetchInfiniteQuery-RS3Qz-7B.mjs.map +0 -1
- package/dist/PrefetchInfiniteQuery-cCSXqKVR.cjs +0 -25
- package/dist/PrefetchInfiniteQuery-cCSXqKVR.cjs.map +0 -1
- package/dist/PrefetchQuery-0pdYNtpS.cjs +0 -25
- package/dist/PrefetchQuery-0pdYNtpS.cjs.map +0 -1
- package/dist/PrefetchQuery-CeQ0yxDL.d.cts +0 -17
- package/dist/PrefetchQuery-CeQ0yxDL.d.cts.map +0 -1
- package/dist/PrefetchQuery-DAqAWOeP.d.mts +0 -17
- package/dist/PrefetchQuery-DAqAWOeP.d.mts.map +0 -1
- package/dist/PrefetchQuery-uh4idoXK.mjs +0 -20
- package/dist/PrefetchQuery-uh4idoXK.mjs.map +0 -1
- package/dist/QueriesHydration-27lFZeB8.mjs.map +0 -1
- package/dist/QueriesHydration-B89HKn9y.d.cts +0 -106
- package/dist/QueriesHydration-B89HKn9y.d.cts.map +0 -1
- package/dist/QueriesHydration-BYKU-Mte.cjs.map +0 -1
- package/dist/QueriesHydration-BeMkJU3l.d.mts +0 -106
- package/dist/QueriesHydration-BeMkJU3l.d.mts.map +0 -1
- package/dist/QueryClientConsumer-D3h25GmM.d.cts +0 -18
- package/dist/QueryClientConsumer-D3h25GmM.d.cts.map +0 -1
- package/dist/QueryClientConsumer-DNkucS1e.d.mts +0 -18
- package/dist/QueryClientConsumer-DNkucS1e.d.mts.map +0 -1
- package/dist/QueryClientConsumer-e7PyaFF3.mjs +0 -14
- package/dist/QueryClientConsumer-e7PyaFF3.mjs.map +0 -1
- package/dist/QueryClientConsumer-mF0OUwkq.cjs +0 -19
- package/dist/QueryClientConsumer-mF0OUwkq.cjs.map +0 -1
- package/dist/SuspenseInfiniteQuery-Bt7GeiHi.d.cts +0 -32
- package/dist/SuspenseInfiniteQuery-Bt7GeiHi.d.cts.map +0 -1
- package/dist/SuspenseInfiniteQuery-CSd2Hyym.d.mts +0 -32
- package/dist/SuspenseInfiniteQuery-CSd2Hyym.d.mts.map +0 -1
- package/dist/SuspenseInfiniteQuery-Dq97Dear.cjs +0 -35
- package/dist/SuspenseInfiniteQuery-Dq97Dear.cjs.map +0 -1
- package/dist/SuspenseInfiniteQuery-DwW5I_M2.mjs +0 -30
- package/dist/SuspenseInfiniteQuery-DwW5I_M2.mjs.map +0 -1
- package/dist/SuspenseQueries-B-UR1dnn.d.cts +0 -31
- package/dist/SuspenseQueries-B-UR1dnn.d.cts.map +0 -1
- package/dist/SuspenseQueries-Brk6gtMw.cjs +0 -31
- package/dist/SuspenseQueries-Brk6gtMw.cjs.map +0 -1
- package/dist/SuspenseQueries-C0mF_XD_.mjs +0 -26
- package/dist/SuspenseQueries-C0mF_XD_.mjs.map +0 -1
- package/dist/SuspenseQueries-CF_WoDIW.d.mts +0 -31
- package/dist/SuspenseQueries-CF_WoDIW.d.mts.map +0 -1
- package/dist/SuspenseQuery--nIIoDt1.cjs +0 -35
- package/dist/SuspenseQuery--nIIoDt1.cjs.map +0 -1
- package/dist/SuspenseQuery-BKoPQQ_o.d.cts +0 -31
- package/dist/SuspenseQuery-BKoPQQ_o.d.cts.map +0 -1
- package/dist/SuspenseQuery-BZ20Rsoo.d.mts +0 -31
- package/dist/SuspenseQuery-BZ20Rsoo.d.mts.map +0 -1
- package/dist/SuspenseQuery-CgN3lrzL.mjs +0 -30
- package/dist/SuspenseQuery-CgN3lrzL.mjs.map +0 -1
- package/dist/createGetQueryClient-B0yrcyXF.mjs +0 -63
- package/dist/createGetQueryClient-B0yrcyXF.mjs.map +0 -1
- package/dist/createGetQueryClient-DTKVVwpJ.d.mts +0 -54
- package/dist/createGetQueryClient-DTKVVwpJ.d.mts.map +0 -1
- package/dist/createGetQueryClient-iXoXO7so.d.cts +0 -54
- package/dist/createGetQueryClient-iXoXO7so.d.cts.map +0 -1
- package/dist/createGetQueryClient-nXvPqrrS.cjs +0 -68
- package/dist/createGetQueryClient-nXvPqrrS.cjs.map +0 -1
- package/dist/infiniteQueryOptions-2KFmTqEY.mjs +0 -17
- package/dist/infiniteQueryOptions-2KFmTqEY.mjs.map +0 -1
- package/dist/infiniteQueryOptions-BVac5B-c.cjs +0 -22
- package/dist/infiniteQueryOptions-BVac5B-c.cjs.map +0 -1
- package/dist/infiniteQueryOptions-Be7VYTUR.d.cts +0 -29
- package/dist/infiniteQueryOptions-Be7VYTUR.d.cts.map +0 -1
- package/dist/infiniteQueryOptions-Bpz4mFYH.d.mts +0 -29
- package/dist/infiniteQueryOptions-Bpz4mFYH.d.mts.map +0 -1
- package/dist/mutationOptions-BIOn3zne.cjs +0 -14
- package/dist/mutationOptions-BIOn3zne.cjs.map +0 -1
- package/dist/mutationOptions-BZS10WEJ.d.mts +0 -7
- package/dist/mutationOptions-BZS10WEJ.d.mts.map +0 -1
- package/dist/mutationOptions-C4emetVL.mjs +0 -8
- package/dist/mutationOptions-C4emetVL.mjs.map +0 -1
- package/dist/mutationOptions-Eid3aM1W.d.cts +0 -7
- package/dist/mutationOptions-Eid3aM1W.d.cts.map +0 -1
- package/dist/queryOptions-92vSd4eV.cjs +0 -22
- package/dist/queryOptions-92vSd4eV.cjs.map +0 -1
- package/dist/queryOptions-DILe-4vk.d.mts +0 -29
- package/dist/queryOptions-DILe-4vk.d.mts.map +0 -1
- package/dist/queryOptions-DNGHeGX5.d.cts +0 -29
- package/dist/queryOptions-DNGHeGX5.d.cts.map +0 -1
- package/dist/queryOptions-Dnf4-wlk.mjs +0 -17
- package/dist/queryOptions-Dnf4-wlk.mjs.map +0 -1
- package/dist/usePrefetchInfiniteQuery-B0_Ladyp.d.mts +0 -12
- package/dist/usePrefetchInfiniteQuery-B0_Ladyp.d.mts.map +0 -1
- package/dist/usePrefetchInfiniteQuery-BmZtlLeD.cjs +0 -20
- package/dist/usePrefetchInfiniteQuery-BmZtlLeD.cjs.map +0 -1
- package/dist/usePrefetchInfiniteQuery-CQSN-P9m.mjs +0 -15
- package/dist/usePrefetchInfiniteQuery-CQSN-P9m.mjs.map +0 -1
- package/dist/usePrefetchInfiniteQuery-CRwRctQH.d.cts +0 -12
- package/dist/usePrefetchInfiniteQuery-CRwRctQH.d.cts.map +0 -1
- package/dist/usePrefetchQuery-38O319FT.d.mts +0 -12
- package/dist/usePrefetchQuery-38O319FT.d.mts.map +0 -1
- package/dist/usePrefetchQuery-93Pltnzl.d.cts +0 -12
- package/dist/usePrefetchQuery-93Pltnzl.d.cts.map +0 -1
- package/dist/usePrefetchQuery-CtrJciA6.mjs +0 -15
- package/dist/usePrefetchQuery-CtrJciA6.mjs.map +0 -1
- package/dist/usePrefetchQuery-woiivAJc.cjs +0 -20
- package/dist/usePrefetchQuery-woiivAJc.cjs.map +0 -1
- package/dist/useSuspenseInfiniteQuery-Bh0nh8Kc.d.mts +0 -17
- package/dist/useSuspenseInfiniteQuery-Bh0nh8Kc.d.mts.map +0 -1
- package/dist/useSuspenseInfiniteQuery-CA0jmgbX.cjs +0 -22
- package/dist/useSuspenseInfiniteQuery-CA0jmgbX.cjs.map +0 -1
- package/dist/useSuspenseInfiniteQuery-DUxKOkCo.mjs +0 -17
- package/dist/useSuspenseInfiniteQuery-DUxKOkCo.mjs.map +0 -1
- package/dist/useSuspenseInfiniteQuery-xXu-A7cX.d.cts +0 -17
- package/dist/useSuspenseInfiniteQuery-xXu-A7cX.d.cts.map +0 -1
- package/dist/useSuspenseQueries-Bf0lSTWB.mjs +0 -17
- package/dist/useSuspenseQueries-Bf0lSTWB.mjs.map +0 -1
- package/dist/useSuspenseQueries-CHPLAyeb.d.cts +0 -37
- package/dist/useSuspenseQueries-CHPLAyeb.d.cts.map +0 -1
- package/dist/useSuspenseQueries-DqBaOI3L.cjs +0 -22
- package/dist/useSuspenseQueries-DqBaOI3L.cjs.map +0 -1
- package/dist/useSuspenseQueries-pfI8hFSM.d.mts +0 -37
- package/dist/useSuspenseQueries-pfI8hFSM.d.mts.map +0 -1
- package/dist/useSuspenseQuery-41ONxa6i.cjs +0 -22
- package/dist/useSuspenseQuery-41ONxa6i.cjs.map +0 -1
- package/dist/useSuspenseQuery-CVWQeHhd.mjs +0 -17
- package/dist/useSuspenseQuery-CVWQeHhd.mjs.map +0 -1
- package/dist/useSuspenseQuery-DG0Jz1Da.d.mts +0 -37
- package/dist/useSuspenseQuery-DG0Jz1Da.d.mts.map +0 -1
- package/dist/useSuspenseQuery-DiNomNWA.d.cts +0 -37
- package/dist/useSuspenseQuery-DiNomNWA.d.cts.map +0 -1
package/dist/IsFetching.cjs
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_objectWithoutProperties = require('./objectWithoutProperties-CfjOeCpP.cjs');
|
|
5
|
+
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
//#region src/IsFetching.tsx
|
|
9
|
+
const _excluded = ["children"];
|
|
10
|
+
/**
|
|
11
|
+
* Renders the current fetching count for queries that match the given filters.
|
|
12
|
+
* @experimental This is an experimental feature.
|
|
13
|
+
*/
|
|
14
|
+
const IsFetching = (_ref) => {
|
|
15
|
+
let { children } = _ref;
|
|
16
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children((0, _tanstack_react_query.useIsFetching)(require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded))) });
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.IsFetching = IsFetching;
|
|
21
|
+
//# sourceMappingURL=IsFetching.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsFetching.cjs","names":[],"sources":["../src/IsFetching.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;;mBAUE;;;;;AADF,MAAa,cAAc,SAGqE;KAHrE,EACzB;AAE8F,QAC9F,mFAAG,4HAA8B,CAAC,EAAI"}
|
package/dist/IsFetching.d.cts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { QueryFilters, useIsFetching } from "@tanstack/react-query";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/IsFetching.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Renders the current fetching count for queries that match the given filters.
|
|
8
|
+
* @experimental This is an experimental feature.
|
|
9
|
+
*/
|
|
10
|
+
declare const IsFetching: ({
|
|
11
|
+
children,
|
|
12
|
+
...filter
|
|
13
|
+
}: QueryFilters & {
|
|
14
|
+
children: (isFetching: ReturnType<typeof useIsFetching>) => ReactNode;
|
|
15
|
+
}) => react_jsx_runtime0.JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { IsFetching };
|
|
18
|
+
//# sourceMappingURL=IsFetching.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsFetching.d.cts","names":[],"sources":["../src/IsFetching.tsx"],"mappings":";;;;;;;;AASA;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.d.mts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { QueryFilters, useIsFetching } from "@tanstack/react-query";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/IsFetching.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Renders the current fetching count for queries that match the given filters.
|
|
8
|
+
* @experimental This is an experimental feature.
|
|
9
|
+
*/
|
|
10
|
+
declare const IsFetching: ({
|
|
11
|
+
children,
|
|
12
|
+
...filter
|
|
13
|
+
}: QueryFilters & {
|
|
14
|
+
children: (isFetching: ReturnType<typeof useIsFetching>) => ReactNode;
|
|
15
|
+
}) => react_jsx_runtime0.JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { IsFetching };
|
|
18
|
+
//# sourceMappingURL=IsFetching.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsFetching.d.mts","names":[],"sources":["../src/IsFetching.tsx"],"mappings":";;;;;;;;AASA;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,5 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { t as
|
|
3
|
+
import { t as _objectWithoutProperties } from "./objectWithoutProperties-CZk5Qmfh.mjs";
|
|
4
|
+
import { useIsFetching } from "@tanstack/react-query";
|
|
5
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
//#region src/IsFetching.tsx
|
|
8
|
+
const _excluded = ["children"];
|
|
9
|
+
/**
|
|
10
|
+
* Renders the current fetching count for queries that match the given filters.
|
|
11
|
+
* @experimental This is an experimental feature.
|
|
12
|
+
*/
|
|
13
|
+
const IsFetching = (_ref) => {
|
|
14
|
+
let { children } = _ref;
|
|
15
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(useIsFetching(_objectWithoutProperties(_ref, _excluded))) });
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { IsFetching };
|
|
20
|
+
//# sourceMappingURL=IsFetching.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsFetching.mjs","names":[],"sources":["../src/IsFetching.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;mBAUE;;;;;AADF,MAAa,cAAc,SAGqE;KAHrE,EACzB;AAE8F,QAC9F,0CAAG,SAAS,wDAAqB,CAAC,EAAI"}
|
package/dist/Mutation.cjs
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_objectWithoutProperties = require('./objectWithoutProperties-CfjOeCpP.cjs');
|
|
5
|
+
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
//#region src/Mutation.tsx
|
|
9
|
+
const _excluded = ["children"];
|
|
10
|
+
function Mutation(_ref) {
|
|
11
|
+
let { children } = _ref;
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children((0, _tanstack_react_query.useMutation)(require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded))) });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.Mutation = Mutation;
|
|
17
|
+
//# sourceMappingURL=Mutation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mutation.cjs","names":[],"sources":["../src/Mutation.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;;mBAME;AADF,SAAgB,SAAmF,MAKhG;KALgG,EACjG;AAKA,QAAO,mFAAG,0HAA6B,CAAC,EAAI"}
|
package/dist/Mutation.d.cts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/Mutation.d.ts
|
|
6
|
+
declare function Mutation<TData = unknown, TError = unknown, TVariables = void, TContext = unknown>({
|
|
7
|
+
children,
|
|
8
|
+
...options
|
|
9
|
+
}: UseMutationOptions<TData, TError, TVariables, TContext> & {
|
|
10
|
+
children: (mutationResult: UseMutationResult<TData, TError, TVariables, TContext>) => ReactNode;
|
|
11
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Mutation };
|
|
14
|
+
//# sourceMappingURL=Mutation.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mutation.d.cts","names":[],"sources":["../src/Mutation.tsx"],"mappings":";;;;;iBAKgB,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
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/Mutation.d.ts
|
|
6
|
+
declare function Mutation<TData = unknown, TError = unknown, TVariables = void, TContext = unknown>({
|
|
7
|
+
children,
|
|
8
|
+
...options
|
|
9
|
+
}: UseMutationOptions<TData, TError, TVariables, TContext> & {
|
|
10
|
+
children: (mutationResult: UseMutationResult<TData, TError, TVariables, TContext>) => ReactNode;
|
|
11
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Mutation };
|
|
14
|
+
//# sourceMappingURL=Mutation.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mutation.d.mts","names":[],"sources":["../src/Mutation.tsx"],"mappings":";;;;;iBAKgB,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,5 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { t as
|
|
3
|
+
import { t as _objectWithoutProperties } from "./objectWithoutProperties-CZk5Qmfh.mjs";
|
|
4
|
+
import { useMutation } from "@tanstack/react-query";
|
|
5
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
//#region src/Mutation.tsx
|
|
8
|
+
const _excluded = ["children"];
|
|
9
|
+
function Mutation(_ref) {
|
|
10
|
+
let { children } = _ref;
|
|
11
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(useMutation(_objectWithoutProperties(_ref, _excluded))) });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Mutation };
|
|
16
|
+
//# sourceMappingURL=Mutation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mutation.mjs","names":[],"sources":["../src/Mutation.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;mBAME;AADF,SAAgB,SAAmF,MAKhG;KALgG,EACjG;AAKA,QAAO,0CAAG,SAAS,sDAAoB,CAAC,EAAI"}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_usePrefetchInfiniteQuery = require('./usePrefetchInfiniteQuery.cjs');
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
//#region src/PrefetchInfiniteQuery.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A component that allows you to use `usePrefetchInfiniteQuery` in JSX, avoiding the limitations of React hooks.
|
|
10
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchInfiniteQuery Suspensive Docs}
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function PrefetchInfiniteQuery(options) {
|
|
17
|
+
require_usePrefetchInfiniteQuery.usePrefetchInfiniteQuery(options);
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.PrefetchInfiniteQuery = PrefetchInfiniteQuery;
|
|
23
|
+
//# sourceMappingURL=PrefetchInfiniteQuery.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.cjs","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;;;;;;;;;AAaA,SAAgB,sBAKd,SAA4E;AAC5E,2DAAyB,QAAQ;AACjC,QAAO,yEAAK"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { FetchInfiniteQueryOptions, QueryKey } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
//#region src/PrefetchInfiniteQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component that allows you to use `usePrefetchInfiniteQuery` in JSX, avoiding the limitations of React hooks.
|
|
7
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchInfiniteQuery Suspensive Docs}
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare function PrefetchInfiniteQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PrefetchInfiniteQuery };
|
|
16
|
+
//# sourceMappingURL=PrefetchInfiniteQuery.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.d.cts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"mappings":";;;;;;;AAaA;;;;;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,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { FetchInfiniteQueryOptions, QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/PrefetchInfiniteQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component that allows you to use `usePrefetchInfiniteQuery` in JSX, avoiding the limitations of React hooks.
|
|
7
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchInfiniteQuery Suspensive Docs}
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare function PrefetchInfiniteQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PrefetchInfiniteQuery };
|
|
16
|
+
//# sourceMappingURL=PrefetchInfiniteQuery.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.d.mts","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"mappings":";;;;;;;AAaA;;;;;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,5 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery.mjs";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
//#region src/PrefetchInfiniteQuery.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A component that allows you to use `usePrefetchInfiniteQuery` in JSX, avoiding the limitations of React hooks.
|
|
9
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchInfiniteQuery Suspensive Docs}
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <PrefetchInfiniteQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
function PrefetchInfiniteQuery(options) {
|
|
16
|
+
usePrefetchInfiniteQuery(options);
|
|
17
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { PrefetchInfiniteQuery };
|
|
22
|
+
//# sourceMappingURL=PrefetchInfiniteQuery.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchInfiniteQuery.mjs","names":[],"sources":["../src/PrefetchInfiniteQuery.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;;;;;;;;AAaA,SAAgB,sBAKd,SAA4E;AAC5E,0BAAyB,QAAQ;AACjC,QAAO,gCAAK"}
|
package/dist/PrefetchQuery.cjs
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_usePrefetchQuery = require('./usePrefetchQuery.cjs');
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
//#region src/PrefetchQuery.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A component that allows you to use usePrefetchQuery in JSX, avoiding the limitations of React hooks.
|
|
10
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchQuery Suspensive Docs}
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function PrefetchQuery(options) {
|
|
17
|
+
require_usePrefetchQuery.usePrefetchQuery(options);
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.PrefetchQuery = PrefetchQuery;
|
|
23
|
+
//# sourceMappingURL=PrefetchQuery.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.cjs","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;;;;;;;;;AAaA,SAAgB,cAKd,SAAoE;AACpE,2CAAiB,QAAQ;AACzB,QAAO,yEAAK"}
|
package/dist/PrefetchQuery.d.cts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { FetchQueryOptions, QueryKey } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
//#region src/PrefetchQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component that allows you to use usePrefetchQuery in JSX, avoiding the limitations of React hooks.
|
|
7
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchQuery Suspensive Docs}
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare function PrefetchQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PrefetchQuery };
|
|
16
|
+
//# sourceMappingURL=PrefetchQuery.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.d.cts","names":[],"sources":["../src/PrefetchQuery.tsx"],"mappings":";;;;;;;AAaA;;;;;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"}
|
package/dist/PrefetchQuery.d.mts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { FetchQueryOptions, QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/PrefetchQuery.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component that allows you to use usePrefetchQuery in JSX, avoiding the limitations of React hooks.
|
|
7
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchQuery Suspensive Docs}
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare function PrefetchQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PrefetchQuery };
|
|
16
|
+
//# sourceMappingURL=PrefetchQuery.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.d.mts","names":[],"sources":["../src/PrefetchQuery.tsx"],"mappings":";;;;;;;AAaA;;;;;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"}
|
package/dist/PrefetchQuery.mjs
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { usePrefetchQuery } from "./usePrefetchQuery.mjs";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
//#region src/PrefetchQuery.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A component that allows you to use usePrefetchQuery in JSX, avoiding the limitations of React hooks.
|
|
9
|
+
* @see {@link https://suspensive.org/docs/react-query/PrefetchQuery Suspensive Docs}
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <PrefetchQuery queryKey={['queryKey']} queryFn={queryFn} />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
function PrefetchQuery(options) {
|
|
16
|
+
usePrefetchQuery(options);
|
|
17
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { PrefetchQuery };
|
|
22
|
+
//# sourceMappingURL=PrefetchQuery.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrefetchQuery.mjs","names":[],"sources":["../src/PrefetchQuery.tsx"],"sourcesContent":["'use client'\n\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":";;;;;;;;;;;;;;AAaA,SAAgB,cAKd,SAAoE;AACpE,kBAAiB,QAAQ;AACzB,QAAO,gCAAK"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const require_objectWithoutProperties = require('./objectWithoutProperties-
|
|
2
|
-
const
|
|
3
|
-
const require_objectSpread2 = require('./objectSpread2-
|
|
4
|
-
let
|
|
1
|
+
const require_objectWithoutProperties = require('./objectWithoutProperties-CfjOeCpP.cjs');
|
|
2
|
+
const require_components_ClientOnly = require('./components/ClientOnly.cjs');
|
|
3
|
+
const require_objectSpread2 = require('./objectSpread2-9HkiXZY2.cjs');
|
|
4
|
+
let _tanstack_react_query = require("@tanstack/react-query");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
|
|
7
|
-
//#region \0@oxc-project+runtime@0.
|
|
7
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/asyncToGenerator.js
|
|
8
8
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
9
9
|
try {
|
|
10
10
|
var i = n[a](c), u = i.value;
|
|
11
|
-
} catch (n
|
|
12
|
-
e(n
|
|
11
|
+
} catch (n) {
|
|
12
|
+
e(n);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
@@ -19,11 +19,11 @@ function _asyncToGenerator(n) {
|
|
|
19
19
|
var t = this, e = arguments;
|
|
20
20
|
return new Promise(function(r, o) {
|
|
21
21
|
var a = n.apply(t, e);
|
|
22
|
-
function _next(n
|
|
23
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n
|
|
22
|
+
function _next(n) {
|
|
23
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
24
24
|
}
|
|
25
|
-
function _throw(n
|
|
26
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n
|
|
25
|
+
function _throw(n) {
|
|
26
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
27
27
|
}
|
|
28
28
|
_next(void 0);
|
|
29
29
|
});
|
|
@@ -108,7 +108,7 @@ function QueriesHydration(_x) {
|
|
|
108
108
|
}
|
|
109
109
|
function _QueriesHydration() {
|
|
110
110
|
_QueriesHydration = _asyncToGenerator(function* (_ref) {
|
|
111
|
-
let { queries, children, queryClient = new
|
|
111
|
+
let { queries, children, queryClient = new _tanstack_react_query.QueryClient(), skipSsrOnError = true, timeout } = _ref, props = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
|
|
112
112
|
const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
|
|
113
113
|
try {
|
|
114
114
|
const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
|
|
@@ -116,13 +116,13 @@ function _QueriesHydration() {
|
|
|
116
116
|
timeoutController === null || timeoutController === void 0 || timeoutController.clear();
|
|
117
117
|
} catch (_unused) {
|
|
118
118
|
timeoutController === null || timeoutController === void 0 || timeoutController.clear();
|
|
119
|
-
if (skipSsrOnError) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
119
|
+
if (skipSsrOnError) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_ClientOnly.ClientOnly, {
|
|
120
120
|
fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
|
|
121
121
|
children
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
125
|
-
state: (0,
|
|
124
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tanstack_react_query.Hydrate, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, {
|
|
125
|
+
state: (0, _tanstack_react_query.dehydrate)(queryClient),
|
|
126
126
|
children
|
|
127
127
|
}));
|
|
128
128
|
});
|
|
@@ -145,4 +145,4 @@ Object.defineProperty(exports, 'QueriesHydration', {
|
|
|
145
145
|
return QueriesHydration;
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
|
-
//# sourceMappingURL=QueriesHydration-
|
|
148
|
+
//# sourceMappingURL=QueriesHydration-B9tinfWA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueriesHydration-B9tinfWA.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;;;;wDAqCD;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,0CAAD;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,15 +1,15 @@
|
|
|
1
|
-
import { t as _objectWithoutProperties } from "./objectWithoutProperties-
|
|
2
|
-
import {
|
|
3
|
-
import { t as _objectSpread2 } from "./objectSpread2-
|
|
1
|
+
import { t as _objectWithoutProperties } from "./objectWithoutProperties-CZk5Qmfh.mjs";
|
|
2
|
+
import { ClientOnly } from "./components/ClientOnly.mjs";
|
|
3
|
+
import { t as _objectSpread2 } from "./objectSpread2-BX3M3dlG.mjs";
|
|
4
4
|
import { Hydrate, QueryClient, dehydrate } from "@tanstack/react-query";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
|
-
//#region \0@oxc-project+runtime@0.
|
|
7
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/asyncToGenerator.js
|
|
8
8
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
9
9
|
try {
|
|
10
10
|
var i = n[a](c), u = i.value;
|
|
11
|
-
} catch (n
|
|
12
|
-
e(n
|
|
11
|
+
} catch (n) {
|
|
12
|
+
e(n);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
@@ -19,11 +19,11 @@ function _asyncToGenerator(n) {
|
|
|
19
19
|
var t = this, e = arguments;
|
|
20
20
|
return new Promise(function(r, o) {
|
|
21
21
|
var a = n.apply(t, e);
|
|
22
|
-
function _next(n
|
|
23
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n
|
|
22
|
+
function _next(n) {
|
|
23
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
24
24
|
}
|
|
25
|
-
function _throw(n
|
|
26
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n
|
|
25
|
+
function _throw(n) {
|
|
26
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
27
27
|
}
|
|
28
28
|
_next(void 0);
|
|
29
29
|
});
|
|
@@ -140,4 +140,4 @@ const createTimeoutController = (ms, errorMessage) => {
|
|
|
140
140
|
|
|
141
141
|
//#endregion
|
|
142
142
|
export { QueriesHydration as t };
|
|
143
|
-
//# sourceMappingURL=QueriesHydration-
|
|
143
|
+
//# sourceMappingURL=QueriesHydration-MZQ7Oj60.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueriesHydration-MZQ7Oj60.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,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_QueriesHydration = require('./QueriesHydration-B9tinfWA.cjs');
|
|
2
3
|
|
|
3
4
|
exports.QueriesHydration = require_QueriesHydration.QueriesHydration;
|