@tanstack/react-query 5.101.3 → 5.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/build/legacy/HydrationBoundary.cjs +35 -87
- package/build/legacy/HydrationBoundary.cjs.map +1 -1
- package/build/legacy/HydrationBoundary.d.cts +15 -2
- package/build/legacy/HydrationBoundary.d.cts.map +1 -0
- package/build/legacy/HydrationBoundary.d.ts +15 -2
- package/build/legacy/HydrationBoundary.d.ts.map +1 -0
- package/build/legacy/HydrationBoundary.js +31 -52
- package/build/legacy/HydrationBoundary.js.map +1 -1
- package/build/legacy/IsRestoringProvider.cjs +11 -44
- package/build/legacy/IsRestoringProvider.cjs.map +1 -1
- package/build/legacy/IsRestoringProvider.d.cts +7 -2
- package/build/legacy/IsRestoringProvider.d.cts.map +1 -0
- package/build/legacy/IsRestoringProvider.d.ts +7 -2
- package/build/legacy/IsRestoringProvider.d.ts.map +1 -0
- package/build/legacy/IsRestoringProvider.js +7 -9
- package/build/legacy/IsRestoringProvider.js.map +1 -1
- package/build/legacy/QueryClientProvider.cjs +27 -67
- package/build/legacy/QueryClientProvider.cjs.map +1 -1
- package/build/legacy/QueryClientProvider.d.cts +13 -4
- package/build/legacy/QueryClientProvider.d.cts.map +1 -0
- package/build/legacy/QueryClientProvider.d.ts +13 -4
- package/build/legacy/QueryClientProvider.d.ts.map +1 -0
- package/build/legacy/QueryClientProvider.js +21 -30
- package/build/legacy/QueryClientProvider.js.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.cjs +30 -62
- package/build/legacy/QueryErrorResetBoundary.cjs.map +1 -1
- package/build/legacy/QueryErrorResetBoundary.d.cts +19 -8
- package/build/legacy/QueryErrorResetBoundary.d.cts.map +1 -0
- package/build/legacy/QueryErrorResetBoundary.d.ts +19 -8
- package/build/legacy/QueryErrorResetBoundary.d.ts.map +1 -0
- package/build/legacy/QueryErrorResetBoundary.js +24 -25
- package/build/legacy/QueryErrorResetBoundary.js.map +1 -1
- package/build/legacy/errorBoundaryUtils.cjs +22 -64
- package/build/legacy/errorBoundaryUtils.cjs.map +1 -1
- package/build/legacy/errorBoundaryUtils.d.cts +15 -3
- package/build/legacy/errorBoundaryUtils.d.cts.map +1 -0
- package/build/legacy/errorBoundaryUtils.d.ts +15 -3
- package/build/legacy/errorBoundaryUtils.d.ts.map +1 -0
- package/build/legacy/errorBoundaryUtils.js +15 -26
- package/build/legacy/errorBoundaryUtils.js.map +1 -1
- package/build/legacy/index.cjs +54 -95
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +21 -205
- package/build/legacy/index.d.ts +21 -205
- package/build/legacy/index.js +10 -39
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/infiniteQueryOptions.cjs +6 -30
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +18 -4
- package/build/legacy/infiniteQueryOptions.d.cts.map +1 -0
- package/build/legacy/infiniteQueryOptions.d.ts +18 -4
- package/build/legacy/infiniteQueryOptions.d.ts.map +1 -0
- package/build/legacy/infiniteQueryOptions.js +5 -5
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/mutationOptions.cjs +6 -30
- package/build/legacy/mutationOptions.cjs.map +1 -1
- package/build/legacy/mutationOptions.d.cts +8 -1
- package/build/legacy/mutationOptions.d.cts.map +1 -0
- package/build/legacy/mutationOptions.d.ts +8 -1
- package/build/legacy/mutationOptions.d.ts.map +1 -0
- package/build/legacy/mutationOptions.js +5 -5
- package/build/legacy/mutationOptions.js.map +1 -1
- package/build/legacy/queryOptions.cjs +6 -30
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +19 -4
- package/build/legacy/queryOptions.d.cts.map +1 -0
- package/build/legacy/queryOptions.d.ts +19 -4
- package/build/legacy/queryOptions.d.ts.map +1 -0
- package/build/legacy/queryOptions.js +5 -5
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/build/legacy/suspense.cjs +20 -55
- package/build/legacy/suspense.cjs.map +1 -1
- package/build/legacy/suspense.d.cts +10 -5
- package/build/legacy/suspense.d.cts.map +1 -0
- package/build/legacy/suspense.d.ts +10 -5
- package/build/legacy/suspense.d.ts.map +1 -0
- package/build/legacy/suspense.js +16 -26
- package/build/legacy/suspense.js.map +1 -1
- package/build/legacy/types.cjs +3 -17
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +54 -24
- package/build/legacy/types.d.cts.map +1 -0
- package/build/legacy/types.d.ts +54 -24
- package/build/legacy/types.d.ts.map +1 -0
- package/build/legacy/types.js +5 -0
- package/build/legacy/types.js.map +1 -1
- package/build/legacy/useBaseQuery.cjs +50 -130
- package/build/legacy/useBaseQuery.cjs.map +1 -1
- package/build/legacy/useBaseQuery.d.cts +7 -1
- package/build/legacy/useBaseQuery.d.cts.map +1 -0
- package/build/legacy/useBaseQuery.d.ts +7 -1
- package/build/legacy/useBaseQuery.d.ts.map +1 -0
- package/build/legacy/useBaseQuery.js +45 -103
- package/build/legacy/useBaseQuery.js.map +1 -1
- package/build/legacy/useInfiniteQuery.cjs +8 -36
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +10 -1
- package/build/legacy/useInfiniteQuery.d.cts.map +1 -0
- package/build/legacy/useInfiniteQuery.d.ts +10 -1
- package/build/legacy/useInfiniteQuery.d.ts.map +1 -0
- package/build/legacy/useInfiniteQuery.js +6 -11
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useIsFetching.cjs +13 -52
- package/build/legacy/useIsFetching.cjs.map +1 -1
- package/build/legacy/useIsFetching.d.cts +6 -1
- package/build/legacy/useIsFetching.d.cts.map +1 -0
- package/build/legacy/useIsFetching.d.ts +6 -1
- package/build/legacy/useIsFetching.d.ts.map +1 -0
- package/build/legacy/useIsFetching.js +8 -16
- package/build/legacy/useIsFetching.js.map +1 -1
- package/build/legacy/useMutation.cjs +25 -70
- package/build/legacy/useMutation.cjs.map +1 -1
- package/build/legacy/useMutation.d.cts +7 -1
- package/build/legacy/useMutation.d.cts.map +1 -0
- package/build/legacy/useMutation.d.ts +7 -1
- package/build/legacy/useMutation.d.ts.map +1 -0
- package/build/legacy/useMutation.js +21 -40
- package/build/legacy/useMutation.js.map +1 -1
- package/build/legacy/useMutationState.cjs +31 -78
- package/build/legacy/useMutationState.cjs.map +1 -1
- package/build/legacy/useMutationState.d.cts +12 -2
- package/build/legacy/useMutationState.d.cts.map +1 -0
- package/build/legacy/useMutationState.d.ts +12 -2
- package/build/legacy/useMutationState.d.ts.map +1 -0
- package/build/legacy/useMutationState.js +25 -41
- package/build/legacy/useMutationState.js.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.cjs +9 -34
- package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.cts +7 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.cts.map +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.d.ts +7 -1
- package/build/legacy/usePrefetchInfiniteQuery.d.ts.map +1 -0
- package/build/legacy/usePrefetchInfiniteQuery.js +7 -8
- package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/legacy/usePrefetchQuery.cjs +9 -34
- package/build/legacy/usePrefetchQuery.cjs.map +1 -1
- package/build/legacy/usePrefetchQuery.d.cts +7 -1
- package/build/legacy/usePrefetchQuery.d.cts.map +1 -0
- package/build/legacy/usePrefetchQuery.d.ts +7 -1
- package/build/legacy/usePrefetchQuery.d.ts.map +1 -0
- package/build/legacy/usePrefetchQuery.js +7 -8
- package/build/legacy/usePrefetchQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs +67 -125
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.d.cts +57 -3
- package/build/legacy/useQueries.d.cts.map +1 -0
- package/build/legacy/useQueries.d.ts +57 -3
- package/build/legacy/useQueries.d.ts.map +1 -0
- package/build/legacy/useQueries.js +61 -101
- package/build/legacy/useQueries.js.map +1 -1
- package/build/legacy/useQuery.cjs +8 -32
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +10 -1
- package/build/legacy/useQuery.d.cts.map +1 -0
- package/build/legacy/useQuery.d.ts +10 -1
- package/build/legacy/useQuery.d.ts.map +1 -0
- package/build/legacy/useQuery.js +6 -7
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.cjs +18 -47
- package/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useSuspenseInfiniteQuery.d.cts +7 -1
- package/build/legacy/useSuspenseInfiniteQuery.d.cts.map +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.d.ts +7 -1
- package/build/legacy/useSuspenseInfiniteQuery.d.ts.map +1 -0
- package/build/legacy/useSuspenseInfiniteQuery.js +16 -22
- package/build/legacy/useSuspenseInfiniteQuery.js.map +1 -1
- package/build/legacy/useSuspenseQueries.cjs +23 -52
- package/build/legacy/useSuspenseQueries.cjs.map +1 -1
- package/build/legacy/useSuspenseQueries.d.cts +60 -3
- package/build/legacy/useSuspenseQueries.d.cts.map +1 -0
- package/build/legacy/useSuspenseQueries.d.ts +60 -3
- package/build/legacy/useSuspenseQueries.d.ts.map +1 -0
- package/build/legacy/useSuspenseQueries.js +21 -27
- package/build/legacy/useSuspenseQueries.js.map +1 -1
- package/build/legacy/useSuspenseQuery.cjs +18 -48
- package/build/legacy/useSuspenseQuery.cjs.map +1 -1
- package/build/legacy/useSuspenseQuery.d.cts +7 -1
- package/build/legacy/useSuspenseQuery.d.cts.map +1 -0
- package/build/legacy/useSuspenseQuery.d.ts +7 -1
- package/build/legacy/useSuspenseQuery.d.ts.map +1 -0
- package/build/legacy/useSuspenseQuery.js +16 -23
- package/build/legacy/useSuspenseQuery.js.map +1 -1
- package/build/modern/HydrationBoundary.cjs +35 -87
- package/build/modern/HydrationBoundary.cjs.map +1 -1
- package/build/modern/HydrationBoundary.d.cts +15 -2
- package/build/modern/HydrationBoundary.d.cts.map +1 -0
- package/build/modern/HydrationBoundary.d.ts +15 -2
- package/build/modern/HydrationBoundary.d.ts.map +1 -0
- package/build/modern/HydrationBoundary.js +31 -52
- package/build/modern/HydrationBoundary.js.map +1 -1
- package/build/modern/IsRestoringProvider.cjs +11 -44
- package/build/modern/IsRestoringProvider.cjs.map +1 -1
- package/build/modern/IsRestoringProvider.d.cts +7 -2
- package/build/modern/IsRestoringProvider.d.cts.map +1 -0
- package/build/modern/IsRestoringProvider.d.ts +7 -2
- package/build/modern/IsRestoringProvider.d.ts.map +1 -0
- package/build/modern/IsRestoringProvider.js +7 -9
- package/build/modern/IsRestoringProvider.js.map +1 -1
- package/build/modern/QueryClientProvider.cjs +27 -67
- package/build/modern/QueryClientProvider.cjs.map +1 -1
- package/build/modern/QueryClientProvider.d.cts +13 -4
- package/build/modern/QueryClientProvider.d.cts.map +1 -0
- package/build/modern/QueryClientProvider.d.ts +13 -4
- package/build/modern/QueryClientProvider.d.ts.map +1 -0
- package/build/modern/QueryClientProvider.js +21 -30
- package/build/modern/QueryClientProvider.js.map +1 -1
- package/build/modern/QueryErrorResetBoundary.cjs +30 -62
- package/build/modern/QueryErrorResetBoundary.cjs.map +1 -1
- package/build/modern/QueryErrorResetBoundary.d.cts +19 -8
- package/build/modern/QueryErrorResetBoundary.d.cts.map +1 -0
- package/build/modern/QueryErrorResetBoundary.d.ts +19 -8
- package/build/modern/QueryErrorResetBoundary.d.ts.map +1 -0
- package/build/modern/QueryErrorResetBoundary.js +24 -25
- package/build/modern/QueryErrorResetBoundary.js.map +1 -1
- package/build/modern/errorBoundaryUtils.cjs +22 -64
- package/build/modern/errorBoundaryUtils.cjs.map +1 -1
- package/build/modern/errorBoundaryUtils.d.cts +15 -3
- package/build/modern/errorBoundaryUtils.d.cts.map +1 -0
- package/build/modern/errorBoundaryUtils.d.ts +15 -3
- package/build/modern/errorBoundaryUtils.d.ts.map +1 -0
- package/build/modern/errorBoundaryUtils.js +15 -26
- package/build/modern/errorBoundaryUtils.js.map +1 -1
- package/build/modern/index.cjs +54 -95
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +21 -205
- package/build/modern/index.d.ts +21 -205
- package/build/modern/index.js +10 -39
- package/build/modern/index.js.map +1 -1
- package/build/modern/infiniteQueryOptions.cjs +6 -30
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +18 -4
- package/build/modern/infiniteQueryOptions.d.cts.map +1 -0
- package/build/modern/infiniteQueryOptions.d.ts +18 -4
- package/build/modern/infiniteQueryOptions.d.ts.map +1 -0
- package/build/modern/infiniteQueryOptions.js +5 -5
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/mutationOptions.cjs +6 -30
- package/build/modern/mutationOptions.cjs.map +1 -1
- package/build/modern/mutationOptions.d.cts +8 -1
- package/build/modern/mutationOptions.d.cts.map +1 -0
- package/build/modern/mutationOptions.d.ts +8 -1
- package/build/modern/mutationOptions.d.ts.map +1 -0
- package/build/modern/mutationOptions.js +5 -5
- package/build/modern/mutationOptions.js.map +1 -1
- package/build/modern/queryOptions.cjs +6 -30
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +19 -4
- package/build/modern/queryOptions.d.cts.map +1 -0
- package/build/modern/queryOptions.d.ts +19 -4
- package/build/modern/queryOptions.d.ts.map +1 -0
- package/build/modern/queryOptions.js +5 -5
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/build/modern/suspense.cjs +20 -55
- package/build/modern/suspense.cjs.map +1 -1
- package/build/modern/suspense.d.cts +10 -5
- package/build/modern/suspense.d.cts.map +1 -0
- package/build/modern/suspense.d.ts +10 -5
- package/build/modern/suspense.d.ts.map +1 -0
- package/build/modern/suspense.js +16 -26
- package/build/modern/suspense.js.map +1 -1
- package/build/modern/types.cjs +3 -17
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +54 -24
- package/build/modern/types.d.cts.map +1 -0
- package/build/modern/types.d.ts +54 -24
- package/build/modern/types.d.ts.map +1 -0
- package/build/modern/types.js +5 -0
- package/build/modern/types.js.map +1 -1
- package/build/modern/useBaseQuery.cjs +50 -127
- package/build/modern/useBaseQuery.cjs.map +1 -1
- package/build/modern/useBaseQuery.d.cts +7 -1
- package/build/modern/useBaseQuery.d.cts.map +1 -0
- package/build/modern/useBaseQuery.d.ts +7 -1
- package/build/modern/useBaseQuery.d.ts.map +1 -0
- package/build/modern/useBaseQuery.js +45 -100
- package/build/modern/useBaseQuery.js.map +1 -1
- package/build/modern/useInfiniteQuery.cjs +8 -36
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +10 -1
- package/build/modern/useInfiniteQuery.d.cts.map +1 -0
- package/build/modern/useInfiniteQuery.d.ts +10 -1
- package/build/modern/useInfiniteQuery.d.ts.map +1 -0
- package/build/modern/useInfiniteQuery.js +6 -11
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useIsFetching.cjs +13 -52
- package/build/modern/useIsFetching.cjs.map +1 -1
- package/build/modern/useIsFetching.d.cts +6 -1
- package/build/modern/useIsFetching.d.cts.map +1 -0
- package/build/modern/useIsFetching.d.ts +6 -1
- package/build/modern/useIsFetching.d.ts.map +1 -0
- package/build/modern/useIsFetching.js +8 -16
- package/build/modern/useIsFetching.js.map +1 -1
- package/build/modern/useMutation.cjs +25 -70
- package/build/modern/useMutation.cjs.map +1 -1
- package/build/modern/useMutation.d.cts +7 -1
- package/build/modern/useMutation.d.cts.map +1 -0
- package/build/modern/useMutation.d.ts +7 -1
- package/build/modern/useMutation.d.ts.map +1 -0
- package/build/modern/useMutation.js +21 -40
- package/build/modern/useMutation.js.map +1 -1
- package/build/modern/useMutationState.cjs +31 -78
- package/build/modern/useMutationState.cjs.map +1 -1
- package/build/modern/useMutationState.d.cts +12 -2
- package/build/modern/useMutationState.d.cts.map +1 -0
- package/build/modern/useMutationState.d.ts +12 -2
- package/build/modern/useMutationState.d.ts.map +1 -0
- package/build/modern/useMutationState.js +25 -41
- package/build/modern/useMutationState.js.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.cjs +9 -34
- package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -1
- package/build/modern/usePrefetchInfiniteQuery.d.cts +7 -1
- package/build/modern/usePrefetchInfiniteQuery.d.cts.map +1 -0
- package/build/modern/usePrefetchInfiniteQuery.d.ts +7 -1
- package/build/modern/usePrefetchInfiniteQuery.d.ts.map +1 -0
- package/build/modern/usePrefetchInfiniteQuery.js +7 -8
- package/build/modern/usePrefetchInfiniteQuery.js.map +1 -1
- package/build/modern/usePrefetchQuery.cjs +9 -34
- package/build/modern/usePrefetchQuery.cjs.map +1 -1
- package/build/modern/usePrefetchQuery.d.cts +7 -1
- package/build/modern/usePrefetchQuery.d.cts.map +1 -0
- package/build/modern/usePrefetchQuery.d.ts +7 -1
- package/build/modern/usePrefetchQuery.d.ts.map +1 -0
- package/build/modern/usePrefetchQuery.js +7 -8
- package/build/modern/usePrefetchQuery.js.map +1 -1
- package/build/modern/useQueries.cjs +67 -125
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.d.cts +57 -3
- package/build/modern/useQueries.d.cts.map +1 -0
- package/build/modern/useQueries.d.ts +57 -3
- package/build/modern/useQueries.d.ts.map +1 -0
- package/build/modern/useQueries.js +61 -101
- package/build/modern/useQueries.js.map +1 -1
- package/build/modern/useQuery.cjs +8 -32
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +10 -1
- package/build/modern/useQuery.d.cts.map +1 -0
- package/build/modern/useQuery.d.ts +10 -1
- package/build/modern/useQuery.d.ts.map +1 -0
- package/build/modern/useQuery.js +6 -7
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.cjs +18 -47
- package/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -1
- package/build/modern/useSuspenseInfiniteQuery.d.cts +7 -1
- package/build/modern/useSuspenseInfiniteQuery.d.cts.map +1 -0
- package/build/modern/useSuspenseInfiniteQuery.d.ts +7 -1
- package/build/modern/useSuspenseInfiniteQuery.d.ts.map +1 -0
- package/build/modern/useSuspenseInfiniteQuery.js +16 -22
- package/build/modern/useSuspenseInfiniteQuery.js.map +1 -1
- package/build/modern/useSuspenseQueries.cjs +23 -52
- package/build/modern/useSuspenseQueries.cjs.map +1 -1
- package/build/modern/useSuspenseQueries.d.cts +60 -3
- package/build/modern/useSuspenseQueries.d.cts.map +1 -0
- package/build/modern/useSuspenseQueries.d.ts +60 -3
- package/build/modern/useSuspenseQueries.d.ts.map +1 -0
- package/build/modern/useSuspenseQueries.js +21 -27
- package/build/modern/useSuspenseQueries.js.map +1 -1
- package/build/modern/useSuspenseQuery.cjs +18 -48
- package/build/modern/useSuspenseQuery.cjs.map +1 -1
- package/build/modern/useSuspenseQuery.d.cts +7 -1
- package/build/modern/useSuspenseQuery.d.cts.map +1 -0
- package/build/modern/useSuspenseQuery.d.ts +7 -1
- package/build/modern/useSuspenseQuery.d.ts.map +1 -0
- package/build/modern/useSuspenseQuery.js +16 -23
- package/build/modern/useSuspenseQuery.js.map +1 -1
- package/build/query-codemods/root.eslint.config.js +1 -1
- package/package.json +6 -8
- package/src/errorBoundaryUtils.ts +1 -5
- package/src/index.ts +1 -1
- package/src/infiniteQueryOptions.ts +7 -10
- package/src/queryOptions.ts +7 -10
- package/src/suspense.ts +0 -5
- package/src/types.ts +47 -10
- package/src/useBaseQuery.ts +1 -32
- package/src/useMutation.ts +6 -2
- package/src/useMutationState.ts +32 -7
- package/src/usePrefetchInfiniteQuery.tsx +8 -5
- package/src/usePrefetchQuery.tsx +12 -3
- package/src/useQueries.ts +6 -3
- package/src/useQuery.ts +3 -3
- package/src/useSuspenseInfiniteQuery.ts +1 -0
- package/build/legacy/_tsup-dts-rollup.d.cts +0 -947
- package/build/legacy/_tsup-dts-rollup.d.ts +0 -947
- package/build/modern/_tsup-dts-rollup.d.cts +0 -947
- package/build/modern/_tsup-dts-rollup.d.ts +0 -947
package/README.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
<img src="https://static.scarf.sh/a.png?x-pxid=be2d8a11-9712-4c1d-9963-580b2d4fb133" />
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<picture>
|
|
4
|
+
<source
|
|
5
|
+
media="(prefers-color-scheme: dark)"
|
|
6
|
+
srcset="https://tanstack.com/api/readme/query.png?framework=react&theme=dark"
|
|
7
|
+
/>
|
|
8
|
+
<source
|
|
9
|
+
media="(prefers-color-scheme: light)"
|
|
10
|
+
srcset="https://tanstack.com/api/readme/query.png?framework=react"
|
|
11
|
+
/>
|
|
12
|
+
<img
|
|
13
|
+
src="https://tanstack.com/api/readme/query.png?framework=react"
|
|
14
|
+
alt="TanStack React Query"
|
|
15
|
+
width="900"
|
|
16
|
+
/>
|
|
17
|
+
</picture>
|
|
4
18
|
|
|
5
19
|
Hooks for fetching, caching and updating asynchronous data in React
|
|
6
20
|
|
|
@@ -1,91 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
4
|
+
const require_QueryClientProvider = require("./QueryClientProvider.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
7
|
+
let _tanstack_query_core = require("@tanstack/query-core");
|
|
8
|
+
//#region src/HydrationBoundary.tsx
|
|
9
|
+
const HydrationBoundary = ({ children, options = {}, state, queryClient }) => {
|
|
10
|
+
const client = require_QueryClientProvider.useQueryClient(queryClient);
|
|
11
|
+
const optionsRef = react.useRef(options);
|
|
12
|
+
react.useEffect(() => {
|
|
13
|
+
optionsRef.current = options;
|
|
14
|
+
});
|
|
15
|
+
const hydrationQueue = react.useMemo(() => {
|
|
16
|
+
if (state) {
|
|
17
|
+
if (typeof state !== "object") return;
|
|
18
|
+
const queryCache = client.getQueryCache();
|
|
19
|
+
const queries = state.queries || [];
|
|
20
|
+
const newQueries = [];
|
|
21
|
+
const existingQueries = [];
|
|
22
|
+
for (const dehydratedQuery of queries) {
|
|
23
|
+
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
|
|
24
|
+
if (!existingQuery) newQueries.push(dehydratedQuery);
|
|
25
|
+
else if (dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt) existingQueries.push(dehydratedQuery);
|
|
26
|
+
}
|
|
27
|
+
if (newQueries.length > 0) (0, _tanstack_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current);
|
|
28
|
+
if (existingQueries.length > 0) return existingQueries;
|
|
29
|
+
}
|
|
30
|
+
}, [client, state]);
|
|
31
|
+
react.useEffect(() => {
|
|
32
|
+
if (hydrationQueue) (0, _tanstack_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current);
|
|
33
|
+
}, [client, hydrationQueue]);
|
|
34
|
+
return children;
|
|
12
35
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.HydrationBoundary = HydrationBoundary;
|
|
30
38
|
|
|
31
|
-
// src/HydrationBoundary.tsx
|
|
32
|
-
var HydrationBoundary_exports = {};
|
|
33
|
-
__export(HydrationBoundary_exports, {
|
|
34
|
-
HydrationBoundary: () => HydrationBoundary
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(HydrationBoundary_exports);
|
|
37
|
-
var React = __toESM(require("react"), 1);
|
|
38
|
-
var import_query_core = require("@tanstack/query-core");
|
|
39
|
-
var import_QueryClientProvider = require("./QueryClientProvider.cjs");
|
|
40
|
-
var HydrationBoundary = ({
|
|
41
|
-
children,
|
|
42
|
-
options = {},
|
|
43
|
-
state,
|
|
44
|
-
queryClient
|
|
45
|
-
}) => {
|
|
46
|
-
const client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
|
|
47
|
-
const optionsRef = React.useRef(options);
|
|
48
|
-
React.useEffect(() => {
|
|
49
|
-
optionsRef.current = options;
|
|
50
|
-
});
|
|
51
|
-
const hydrationQueue = React.useMemo(() => {
|
|
52
|
-
if (state) {
|
|
53
|
-
if (typeof state !== "object") {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const queryCache = client.getQueryCache();
|
|
57
|
-
const queries = state.queries || [];
|
|
58
|
-
const newQueries = [];
|
|
59
|
-
const existingQueries = [];
|
|
60
|
-
for (const dehydratedQuery of queries) {
|
|
61
|
-
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
|
|
62
|
-
if (!existingQuery) {
|
|
63
|
-
newQueries.push(dehydratedQuery);
|
|
64
|
-
} else {
|
|
65
|
-
const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
|
|
66
|
-
if (hydrationIsNewer) {
|
|
67
|
-
existingQueries.push(dehydratedQuery);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (newQueries.length > 0) {
|
|
72
|
-
(0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current);
|
|
73
|
-
}
|
|
74
|
-
if (existingQueries.length > 0) {
|
|
75
|
-
return existingQueries;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return void 0;
|
|
79
|
-
}, [client, state]);
|
|
80
|
-
React.useEffect(() => {
|
|
81
|
-
if (hydrationQueue) {
|
|
82
|
-
(0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current);
|
|
83
|
-
}
|
|
84
|
-
}, [client, hydrationQueue]);
|
|
85
|
-
return children;
|
|
86
|
-
};
|
|
87
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
-
0 && (module.exports = {
|
|
89
|
-
HydrationBoundary
|
|
90
|
-
});
|
|
91
39
|
//# sourceMappingURL=HydrationBoundary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HydrationBoundary.cjs","names":["useQueryClient","React"],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;;;;;;AAwBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,MAAM,aAAaC,MAAM,OAAO,OAAO;CACvC,MAAM,gBAAgB;EACpB,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,iBACJA,MAAM,cAAc;EAClB,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAKxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAY/B,IATE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eACd,cAAc,MAAM,eAGxB,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAItB,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAEpB,MAAM,gBAAgB;EACpB,IAAI,gBACF,CAAA,GAAA,qBAAA,QAAA,CAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO;AACT"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DehydratedState, HydrateOptions, OmitKeyof, QueryClient } from "@tanstack/query-core";
|
|
3
|
+
//#region src/HydrationBoundary.d.ts
|
|
4
|
+
interface HydrationBoundaryProps {
|
|
5
|
+
state: DehydratedState | null | undefined;
|
|
6
|
+
options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {
|
|
7
|
+
defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>;
|
|
8
|
+
};
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
queryClient?: QueryClient;
|
|
11
|
+
}
|
|
12
|
+
declare const HydrationBoundary: ({ children, options, state, queryClient }: HydrationBoundaryProps) => React.ReactElement;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { HydrationBoundary, HydrationBoundaryProps };
|
|
15
|
+
//# sourceMappingURL=HydrationBoundary.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HydrationBoundary.d.cts","names":[],"sources":["../../src/HydrationBoundary.tsx"],"mappings":";;;UAYiB;EACf,OAAO;EACP,UAAU,UAAU;IAClB,iBAAiB,UACf,QAAQ;;EAIZ,WAAW,MAAM;EACjB,cAAc;;cAGH,sBAAqB,UAAA,SAAA,OAAA,eAK/B,2BAgFkB,MAAM"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DehydratedState, HydrateOptions, OmitKeyof, QueryClient } from "@tanstack/query-core";
|
|
3
|
+
//#region src/HydrationBoundary.d.ts
|
|
4
|
+
interface HydrationBoundaryProps {
|
|
5
|
+
state: DehydratedState | null | undefined;
|
|
6
|
+
options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {
|
|
7
|
+
defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>;
|
|
8
|
+
};
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
queryClient?: QueryClient;
|
|
11
|
+
}
|
|
12
|
+
declare const HydrationBoundary: ({ children, options, state, queryClient }: HydrationBoundaryProps) => React.ReactElement;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { HydrationBoundary, HydrationBoundaryProps };
|
|
15
|
+
//# sourceMappingURL=HydrationBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HydrationBoundary.d.ts","names":[],"sources":["../../src/HydrationBoundary.tsx"],"mappings":";;;UAYiB;EACf,OAAO;EACP,UAAU,UAAU;IAClB,iBAAiB,UACf,QAAQ;;EAIZ,WAAW,MAAM;EACjB,cAAc;;cAGH,sBAAqB,UAAA,SAAA,OAAA,eAK/B,2BAgFkB,MAAM"}
|
|
@@ -1,57 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/HydrationBoundary.tsx
|
|
2
|
+
import { useQueryClient } from "./QueryClientProvider.js";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import { hydrate } from "@tanstack/query-core";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (hydrationIsNewer) {
|
|
34
|
-
existingQueries.push(dehydratedQuery);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (newQueries.length > 0) {
|
|
39
|
-
hydrate(client, { queries: newQueries }, optionsRef.current);
|
|
40
|
-
}
|
|
41
|
-
if (existingQueries.length > 0) {
|
|
42
|
-
return existingQueries;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return void 0;
|
|
46
|
-
}, [client, state]);
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
if (hydrationQueue) {
|
|
49
|
-
hydrate(client, { queries: hydrationQueue }, optionsRef.current);
|
|
50
|
-
}
|
|
51
|
-
}, [client, hydrationQueue]);
|
|
52
|
-
return children;
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
HydrationBoundary
|
|
5
|
+
//#region src/HydrationBoundary.tsx
|
|
6
|
+
const HydrationBoundary = ({ children, options = {}, state, queryClient }) => {
|
|
7
|
+
const client = useQueryClient(queryClient);
|
|
8
|
+
const optionsRef = React.useRef(options);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
optionsRef.current = options;
|
|
11
|
+
});
|
|
12
|
+
const hydrationQueue = React.useMemo(() => {
|
|
13
|
+
if (state) {
|
|
14
|
+
if (typeof state !== "object") return;
|
|
15
|
+
const queryCache = client.getQueryCache();
|
|
16
|
+
const queries = state.queries || [];
|
|
17
|
+
const newQueries = [];
|
|
18
|
+
const existingQueries = [];
|
|
19
|
+
for (const dehydratedQuery of queries) {
|
|
20
|
+
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
|
|
21
|
+
if (!existingQuery) newQueries.push(dehydratedQuery);
|
|
22
|
+
else if (dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt) existingQueries.push(dehydratedQuery);
|
|
23
|
+
}
|
|
24
|
+
if (newQueries.length > 0) hydrate(client, { queries: newQueries }, optionsRef.current);
|
|
25
|
+
if (existingQueries.length > 0) return existingQueries;
|
|
26
|
+
}
|
|
27
|
+
}, [client, state]);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (hydrationQueue) hydrate(client, { queries: hydrationQueue }, optionsRef.current);
|
|
30
|
+
}, [client, hydrationQueue]);
|
|
31
|
+
return children;
|
|
56
32
|
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { HydrationBoundary };
|
|
35
|
+
|
|
57
36
|
//# sourceMappingURL=HydrationBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HydrationBoundary.js","names":[],"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;;;AAwBA,MAAa,qBAAqB,EAChC,UACA,UAAU,CAAC,GACX,OACA,kBAC4B;CAC5B,MAAM,SAAS,eAAe,WAAW;CAEzC,MAAM,aAAa,MAAM,OAAO,OAAO;CACvC,MAAM,gBAAgB;EACpB,WAAW,UAAU;CACvB,CAAC;CAiBD,MAAM,iBACJ,MAAM,cAAc;EAClB,IAAI,OAAO;GACT,IAAI,OAAO,UAAU,UACnB;GAGF,MAAM,aAAa,OAAO,cAAc;GAKxC,MAAM,UAAU,MAAM,WAAW,CAAC;GAElC,MAAM,aAAyC,CAAC;GAChD,MAAM,kBAA8C,CAAC;GACrD,KAAK,MAAM,mBAAmB,SAAS;IACrC,MAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;IAE9D,IAAI,CAAC,eACH,WAAW,KAAK,eAAe;SAY/B,IATE,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,KAAA,KACjC,gBAAgB,eACd,cAAc,MAAM,eAGxB,gBAAgB,KAAK,eAAe;GAG1C;GAEA,IAAI,WAAW,SAAS,GAItB,QAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;GAE7D,IAAI,gBAAgB,SAAS,GAC3B,OAAO;EAEX;CAEF,GAAG,CAAC,QAAQ,KAAK,CAAC;CAEpB,MAAM,gBAAgB;EACpB,IAAI,gBACF,QAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;CAEnE,GAAG,CAAC,QAAQ,cAAc,CAAC;CAE3B,OAAO;AACT"}
|
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
6
|
+
//#region src/IsRestoringProvider.ts
|
|
7
|
+
const IsRestoringContext = react.createContext(false);
|
|
8
|
+
const useIsRestoring = () => react.useContext(IsRestoringContext);
|
|
9
|
+
const IsRestoringProvider = IsRestoringContext.Provider;
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.IsRestoringProvider = IsRestoringProvider;
|
|
12
|
+
exports.useIsRestoring = useIsRestoring;
|
|
30
13
|
|
|
31
|
-
// src/IsRestoringProvider.ts
|
|
32
|
-
var IsRestoringProvider_exports = {};
|
|
33
|
-
__export(IsRestoringProvider_exports, {
|
|
34
|
-
IsRestoringProvider: () => IsRestoringProvider,
|
|
35
|
-
useIsRestoring: () => useIsRestoring
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(IsRestoringProvider_exports);
|
|
38
|
-
var React = __toESM(require("react"), 1);
|
|
39
|
-
var IsRestoringContext = React.createContext(false);
|
|
40
|
-
var useIsRestoring = () => React.useContext(IsRestoringContext);
|
|
41
|
-
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
IsRestoringProvider,
|
|
45
|
-
useIsRestoring
|
|
46
|
-
});
|
|
47
14
|
//# sourceMappingURL=IsRestoringProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IsRestoringProvider.cjs","names":["React"],"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;;;;AAGA,MAAM,qBAAqBA,MAAM,cAAc,KAAK;AAEpD,MAAa,uBAAuBA,MAAM,WAAW,kBAAkB;AACvE,MAAa,sBAAsB,mBAAmB"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/IsRestoringProvider.d.ts
|
|
3
|
+
declare const useIsRestoring: () => boolean;
|
|
4
|
+
declare const IsRestoringProvider: React.Provider<boolean>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { IsRestoringProvider, useIsRestoring };
|
|
7
|
+
//# sourceMappingURL=IsRestoringProvider.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsRestoringProvider.d.cts","names":[],"sources":["../../src/IsRestoringProvider.ts"],"mappings":";;cAKa;cACA,qBAAmB,MAAA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/IsRestoringProvider.d.ts
|
|
3
|
+
declare const useIsRestoring: () => boolean;
|
|
4
|
+
declare const IsRestoringProvider: React.Provider<boolean>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { IsRestoringProvider, useIsRestoring };
|
|
7
|
+
//# sourceMappingURL=IsRestoringProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IsRestoringProvider.d.ts","names":[],"sources":["../../src/IsRestoringProvider.ts"],"mappings":";;cAKa;cACA,qBAAmB,MAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/IsRestoringProvider.ts
|
|
4
2
|
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
//#region src/IsRestoringProvider.ts
|
|
4
|
+
const IsRestoringContext = React.createContext(false);
|
|
5
|
+
const useIsRestoring = () => React.useContext(IsRestoringContext);
|
|
6
|
+
const IsRestoringProvider = IsRestoringContext.Provider;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { IsRestoringProvider, useIsRestoring };
|
|
9
|
+
|
|
12
10
|
//# sourceMappingURL=IsRestoringProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IsRestoringProvider.js","names":[],"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;AAGA,MAAM,qBAAqB,MAAM,cAAc,KAAK;AAEpD,MAAa,uBAAuB,MAAM,WAAW,kBAAkB;AACvE,MAAa,sBAAsB,mBAAmB"}
|
|
@@ -1,72 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
//#region src/QueryClientProvider.tsx
|
|
8
|
+
const QueryClientContext = react.createContext(void 0);
|
|
9
|
+
const useQueryClient = (queryClient) => {
|
|
10
|
+
const client = react.useContext(QueryClientContext);
|
|
11
|
+
if (queryClient) return queryClient;
|
|
12
|
+
if (!client) throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
13
|
+
return client;
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const QueryClientProvider = ({ client, children }) => {
|
|
16
|
+
react.useEffect(() => {
|
|
17
|
+
client.mount();
|
|
18
|
+
return () => {
|
|
19
|
+
client.unmount();
|
|
20
|
+
};
|
|
21
|
+
}, [client]);
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QueryClientContext.Provider, {
|
|
23
|
+
value: client,
|
|
24
|
+
children
|
|
25
|
+
});
|
|
20
26
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.QueryClientContext = QueryClientContext;
|
|
29
|
+
exports.QueryClientProvider = QueryClientProvider;
|
|
30
|
+
exports.useQueryClient = useQueryClient;
|
|
30
31
|
|
|
31
|
-
// src/QueryClientProvider.tsx
|
|
32
|
-
var QueryClientProvider_exports = {};
|
|
33
|
-
__export(QueryClientProvider_exports, {
|
|
34
|
-
QueryClientContext: () => QueryClientContext,
|
|
35
|
-
QueryClientProvider: () => QueryClientProvider,
|
|
36
|
-
useQueryClient: () => useQueryClient
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(QueryClientProvider_exports);
|
|
39
|
-
var React = __toESM(require("react"), 1);
|
|
40
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
-
var QueryClientContext = React.createContext(
|
|
42
|
-
void 0
|
|
43
|
-
);
|
|
44
|
-
var useQueryClient = (queryClient) => {
|
|
45
|
-
const client = React.useContext(QueryClientContext);
|
|
46
|
-
if (queryClient) {
|
|
47
|
-
return queryClient;
|
|
48
|
-
}
|
|
49
|
-
if (!client) {
|
|
50
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
51
|
-
}
|
|
52
|
-
return client;
|
|
53
|
-
};
|
|
54
|
-
var QueryClientProvider = ({
|
|
55
|
-
client,
|
|
56
|
-
children
|
|
57
|
-
}) => {
|
|
58
|
-
React.useEffect(() => {
|
|
59
|
-
client.mount();
|
|
60
|
-
return () => {
|
|
61
|
-
client.unmount();
|
|
62
|
-
};
|
|
63
|
-
}, [client]);
|
|
64
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children });
|
|
65
|
-
};
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
QueryClientContext,
|
|
69
|
-
QueryClientProvider,
|
|
70
|
-
useQueryClient
|
|
71
|
-
});
|
|
72
32
|
//# sourceMappingURL=QueryClientProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"QueryClientProvider.cjs","names":["React"],"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";;;;;;;AAKA,MAAa,qBAAqBA,MAAM,cACtC,KAAA,CACF;AAEA,MAAa,kBAAkB,gBAA8B;CAC3D,MAAM,SAASA,MAAM,WAAW,kBAAkB;CAElD,IAAI,aACF,OAAO;CAGT,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,wDAAwD;CAG1E,OAAO;AACT;AAOA,MAAa,uBAAuB,EAClC,QACA,eACiD;CACjD,MAAM,gBAAgB;EACpB,OAAO,MAAM;EACb,aAAa;GACX,OAAO,QAAQ;EACjB;CACF,GAAG,CAAC,MAAM,CAAC;CAEX,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAmB,UAApB;EAA6B,OAAO;EACjC;CAC0B,CAAA;AAEjC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { QueryClient } from "@tanstack/query-core";
|
|
3
|
+
//#region src/QueryClientProvider.d.ts
|
|
4
|
+
declare const QueryClientContext: React.Context<QueryClient | undefined>;
|
|
5
|
+
declare const useQueryClient: (queryClient?: QueryClient) => QueryClient;
|
|
6
|
+
type QueryClientProviderProps = {
|
|
7
|
+
client: QueryClient;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const QueryClientProvider: ({ client, children }: QueryClientProviderProps) => React.JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { QueryClientContext, QueryClientProvider, QueryClientProviderProps, useQueryClient };
|
|
13
|
+
//# sourceMappingURL=QueryClientProvider.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryClientProvider.d.cts","names":[],"sources":["../../src/QueryClientProvider.tsx"],"mappings":";;;cAKa,oBAAkB,MAAA,QAAA;cAIlB,iBAAkB,cAAc,gBAAW;KAc5C;EACV,QAAQ;EACR,WAAW,MAAM;;cAGN,wBAAuB,QAAA,YAGjC,6BAA2B,MAAM,IAAI"}
|