@tanstack/query-core 5.35.5 → 5.36.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/build/legacy/hydration.d.cts +1 -1
- package/build/legacy/hydration.d.ts +1 -1
- package/build/legacy/index.d.cts +1 -1
- package/build/legacy/index.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
- package/build/legacy/infiniteQueryObserver.cjs +14 -7
- package/build/legacy/infiniteQueryObserver.cjs.map +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +1 -1
- package/build/legacy/infiniteQueryObserver.d.ts +1 -1
- package/build/legacy/infiniteQueryObserver.js +14 -7
- package/build/legacy/infiniteQueryObserver.js.map +1 -1
- package/build/legacy/mutation.d.cts +1 -1
- package/build/legacy/mutation.d.ts +1 -1
- package/build/legacy/mutationCache.d.cts +1 -1
- package/build/legacy/mutationCache.d.ts +1 -1
- package/build/legacy/mutationObserver.d.cts +1 -1
- package/build/legacy/mutationObserver.d.ts +1 -1
- package/build/legacy/queriesObserver.d.cts +1 -1
- package/build/legacy/queriesObserver.d.ts +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryObserver.d.cts +1 -1
- package/build/legacy/queryObserver.d.ts +1 -1
- package/build/legacy/retryer.d.cts +1 -1
- package/build/legacy/retryer.d.ts +1 -1
- package/build/legacy/{types-Br-AgPmc.d.ts → types-B0i0SaOM.d.ts} +59 -0
- package/build/legacy/{types-Ya7vXgfL.d.cts → types-D3f-7LPM.d.cts} +59 -0
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/modern/hydration.d.cts +1 -1
- package/build/modern/hydration.d.ts +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/index.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +1 -1
- package/build/modern/infiniteQueryObserver.cjs +13 -6
- package/build/modern/infiniteQueryObserver.cjs.map +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +1 -1
- package/build/modern/infiniteQueryObserver.d.ts +1 -1
- package/build/modern/infiniteQueryObserver.js +13 -6
- package/build/modern/infiniteQueryObserver.js.map +1 -1
- package/build/modern/mutation.d.cts +1 -1
- package/build/modern/mutation.d.ts +1 -1
- package/build/modern/mutationCache.d.cts +1 -1
- package/build/modern/mutationCache.d.ts +1 -1
- package/build/modern/mutationObserver.d.cts +1 -1
- package/build/modern/mutationObserver.d.ts +1 -1
- package/build/modern/queriesObserver.d.cts +1 -1
- package/build/modern/queriesObserver.d.ts +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryObserver.d.cts +1 -1
- package/build/modern/queryObserver.d.ts +1 -1
- package/build/modern/retryer.d.cts +1 -1
- package/build/modern/retryer.d.ts +1 -1
- package/build/modern/{types-Br-AgPmc.d.ts → types-B0i0SaOM.d.ts} +59 -0
- package/build/modern/{types-Ya7vXgfL.d.cts → types-D3f-7LPM.d.cts} +59 -0
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/__tests__/infiniteQueryObserver.test-d.tsx +2 -0
- package/src/infiniteQueryObserver.ts +16 -8
- package/src/types.ts +59 -0
package/src/types.ts
CHANGED
|
@@ -473,6 +473,13 @@ export interface ResultOptions {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
export interface RefetchOptions extends ResultOptions {
|
|
476
|
+
/**
|
|
477
|
+
* If set to `true`, a currently running request will be cancelled before a new request is made
|
|
478
|
+
*
|
|
479
|
+
* If set to `false`, no refetch will be made if there is already a request running.
|
|
480
|
+
*
|
|
481
|
+
* Defaults to `true`.
|
|
482
|
+
*/
|
|
476
483
|
cancelRefetch?: boolean
|
|
477
484
|
}
|
|
478
485
|
|
|
@@ -486,10 +493,26 @@ export interface InvalidateOptions extends RefetchOptions {}
|
|
|
486
493
|
export interface ResetOptions extends RefetchOptions {}
|
|
487
494
|
|
|
488
495
|
export interface FetchNextPageOptions extends ResultOptions {
|
|
496
|
+
/**
|
|
497
|
+
* If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time,
|
|
498
|
+
* whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
|
|
499
|
+
*
|
|
500
|
+
* If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved.
|
|
501
|
+
*
|
|
502
|
+
* Defaults to `true`.
|
|
503
|
+
*/
|
|
489
504
|
cancelRefetch?: boolean
|
|
490
505
|
}
|
|
491
506
|
|
|
492
507
|
export interface FetchPreviousPageOptions extends ResultOptions {
|
|
508
|
+
/**
|
|
509
|
+
* If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time,
|
|
510
|
+
* whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
|
|
511
|
+
*
|
|
512
|
+
* If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved.
|
|
513
|
+
*
|
|
514
|
+
* Defaults to `true`.
|
|
515
|
+
*/
|
|
493
516
|
cancelRefetch?: boolean
|
|
494
517
|
}
|
|
495
518
|
|
|
@@ -712,15 +735,41 @@ export interface InfiniteQueryObserverBaseResult<
|
|
|
712
735
|
TData = unknown,
|
|
713
736
|
TError = DefaultError,
|
|
714
737
|
> extends QueryObserverBaseResult<TData, TError> {
|
|
738
|
+
/**
|
|
739
|
+
* This function allows you to fetch the next "page" of results.
|
|
740
|
+
*/
|
|
715
741
|
fetchNextPage: (
|
|
716
742
|
options?: FetchNextPageOptions,
|
|
717
743
|
) => Promise<InfiniteQueryObserverResult<TData, TError>>
|
|
744
|
+
/**
|
|
745
|
+
* This function allows you to fetch the previous "page" of results.
|
|
746
|
+
*/
|
|
718
747
|
fetchPreviousPage: (
|
|
719
748
|
options?: FetchPreviousPageOptions,
|
|
720
749
|
) => Promise<InfiniteQueryObserverResult<TData, TError>>
|
|
750
|
+
/**
|
|
751
|
+
* Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
|
752
|
+
*/
|
|
721
753
|
hasNextPage: boolean
|
|
754
|
+
/**
|
|
755
|
+
* Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
|
756
|
+
*/
|
|
722
757
|
hasPreviousPage: boolean
|
|
758
|
+
/**
|
|
759
|
+
* Will be `true` if the query failed while fetching the next page.
|
|
760
|
+
*/
|
|
761
|
+
isFetchNextPageError: boolean
|
|
762
|
+
/**
|
|
763
|
+
* Will be `true` while fetching the next page with `fetchNextPage`.
|
|
764
|
+
*/
|
|
723
765
|
isFetchingNextPage: boolean
|
|
766
|
+
/**
|
|
767
|
+
* Will be `true` if the query failed while fetching the previous page.
|
|
768
|
+
*/
|
|
769
|
+
isFetchPreviousPageError: boolean
|
|
770
|
+
/**
|
|
771
|
+
* Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
|
772
|
+
*/
|
|
724
773
|
isFetchingPreviousPage: boolean
|
|
725
774
|
}
|
|
726
775
|
|
|
@@ -734,6 +783,8 @@ export interface InfiniteQueryObserverPendingResult<
|
|
|
734
783
|
isPending: true
|
|
735
784
|
isLoadingError: false
|
|
736
785
|
isRefetchError: false
|
|
786
|
+
isFetchNextPageError: false
|
|
787
|
+
isFetchPreviousPageError: false
|
|
737
788
|
isSuccess: false
|
|
738
789
|
status: 'pending'
|
|
739
790
|
}
|
|
@@ -749,6 +800,8 @@ export interface InfiniteQueryObserverLoadingResult<
|
|
|
749
800
|
isLoading: true
|
|
750
801
|
isLoadingError: false
|
|
751
802
|
isRefetchError: false
|
|
803
|
+
isFetchNextPageError: false
|
|
804
|
+
isFetchPreviousPageError: false
|
|
752
805
|
isSuccess: false
|
|
753
806
|
status: 'pending'
|
|
754
807
|
}
|
|
@@ -764,6 +817,8 @@ export interface InfiniteQueryObserverLoadingErrorResult<
|
|
|
764
817
|
isLoading: false
|
|
765
818
|
isLoadingError: true
|
|
766
819
|
isRefetchError: false
|
|
820
|
+
isFetchNextPageError: false
|
|
821
|
+
isFetchPreviousPageError: false
|
|
767
822
|
isSuccess: false
|
|
768
823
|
status: 'error'
|
|
769
824
|
}
|
|
@@ -779,6 +834,8 @@ export interface InfiniteQueryObserverRefetchErrorResult<
|
|
|
779
834
|
isLoading: false
|
|
780
835
|
isLoadingError: false
|
|
781
836
|
isRefetchError: true
|
|
837
|
+
isFetchNextPageError: false
|
|
838
|
+
isFetchPreviousPageError: false
|
|
782
839
|
isSuccess: false
|
|
783
840
|
status: 'error'
|
|
784
841
|
}
|
|
@@ -794,6 +851,8 @@ export interface InfiniteQueryObserverSuccessResult<
|
|
|
794
851
|
isLoading: false
|
|
795
852
|
isLoadingError: false
|
|
796
853
|
isRefetchError: false
|
|
854
|
+
isFetchNextPageError: false
|
|
855
|
+
isFetchPreviousPageError: false
|
|
797
856
|
isSuccess: true
|
|
798
857
|
status: 'success'
|
|
799
858
|
}
|