@tanstack/query-core 5.64.2 → 5.66.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-DpBMnFDT.d.ts → hydration-De1u5VYH.d.ts} +170 -130
- package/build/legacy/{hydration-BiRZ4dmX.d.cts → hydration-De8Br-lj.d.cts} +170 -130
- 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.cjs +2 -0
- package/build/legacy/infiniteQueryBehavior.cjs.map +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.js +2 -0
- package/build/legacy/infiniteQueryBehavior.js.map +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +1 -1
- package/build/legacy/infiniteQueryObserver.d.ts +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.cjs +7 -2
- package/build/legacy/query.cjs.map +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/query.js +7 -2
- package/build/legacy/query.js.map +1 -1
- package/build/legacy/queryCache.cjs +1 -1
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/queryCache.js +1 -1
- package/build/legacy/queryCache.js.map +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.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/types.js.map +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/modern/{hydration-DpBMnFDT.d.ts → hydration-De1u5VYH.d.ts} +170 -130
- package/build/modern/{hydration-BiRZ4dmX.d.cts → hydration-De8Br-lj.d.cts} +170 -130
- 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.cjs +2 -0
- package/build/modern/infiniteQueryBehavior.cjs.map +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.js +2 -0
- package/build/modern/infiniteQueryBehavior.js.map +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +1 -1
- package/build/modern/infiniteQueryObserver.d.ts +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.cjs +5 -1
- package/build/modern/query.cjs.map +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/query.js +5 -1
- package/build/modern/query.js.map +1 -1
- package/build/modern/queryCache.cjs +1 -1
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/queryCache.js +1 -1
- package/build/modern/queryCache.js.map +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.cjs.map +1 -1
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/types.js.map +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/package.json +3 -2
- package/src/infiniteQueryBehavior.ts +2 -0
- package/src/query.ts +9 -3
- package/src/queryCache.ts +1 -1
- package/src/types.ts +50 -0
package/src/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
|
|
3
|
+
import type { QueryClient } from './queryClient'
|
|
3
4
|
import type { DehydrateOptions, HydrateOptions } from './hydration'
|
|
4
5
|
import type { MutationState } from './mutation'
|
|
5
6
|
import type { FetchDirection, Query, QueryBehavior } from './query'
|
|
@@ -116,6 +117,7 @@ export type QueryFunctionContext<
|
|
|
116
117
|
TPageParam = never,
|
|
117
118
|
> = [TPageParam] extends [never]
|
|
118
119
|
? {
|
|
120
|
+
client: QueryClient
|
|
119
121
|
queryKey: TQueryKey
|
|
120
122
|
signal: AbortSignal
|
|
121
123
|
meta: QueryMeta | undefined
|
|
@@ -127,6 +129,7 @@ export type QueryFunctionContext<
|
|
|
127
129
|
direction?: unknown
|
|
128
130
|
}
|
|
129
131
|
: {
|
|
132
|
+
client: QueryClient
|
|
130
133
|
queryKey: TQueryKey
|
|
131
134
|
signal: AbortSignal
|
|
132
135
|
pageParam: TPageParam
|
|
@@ -305,6 +308,7 @@ export interface QueryObserverOptions<
|
|
|
305
308
|
* The time in milliseconds after data is considered stale.
|
|
306
309
|
* If set to `Infinity`, the data will never be considered stale.
|
|
307
310
|
* If set to a function, the function will be executed with the query to compute a `staleTime`.
|
|
311
|
+
* Defaults to `0`.
|
|
308
312
|
*/
|
|
309
313
|
staleTime?: StaleTime<TQueryFnData, TError, TQueryData, TQueryKey>
|
|
310
314
|
/**
|
|
@@ -790,6 +794,7 @@ export interface QueryObserverPendingResult<
|
|
|
790
794
|
isLoadingError: false
|
|
791
795
|
isRefetchError: false
|
|
792
796
|
isSuccess: false
|
|
797
|
+
isPlaceholderData: false
|
|
793
798
|
status: 'pending'
|
|
794
799
|
}
|
|
795
800
|
|
|
@@ -805,6 +810,7 @@ export interface QueryObserverLoadingResult<
|
|
|
805
810
|
isLoadingError: false
|
|
806
811
|
isRefetchError: false
|
|
807
812
|
isSuccess: false
|
|
813
|
+
isPlaceholderData: false
|
|
808
814
|
status: 'pending'
|
|
809
815
|
}
|
|
810
816
|
|
|
@@ -820,6 +826,7 @@ export interface QueryObserverLoadingErrorResult<
|
|
|
820
826
|
isLoadingError: true
|
|
821
827
|
isRefetchError: false
|
|
822
828
|
isSuccess: false
|
|
829
|
+
isPlaceholderData: false
|
|
823
830
|
status: 'error'
|
|
824
831
|
}
|
|
825
832
|
|
|
@@ -835,6 +842,7 @@ export interface QueryObserverRefetchErrorResult<
|
|
|
835
842
|
isLoadingError: false
|
|
836
843
|
isRefetchError: true
|
|
837
844
|
isSuccess: false
|
|
845
|
+
isPlaceholderData: false
|
|
838
846
|
status: 'error'
|
|
839
847
|
}
|
|
840
848
|
|
|
@@ -850,6 +858,23 @@ export interface QueryObserverSuccessResult<
|
|
|
850
858
|
isLoadingError: false
|
|
851
859
|
isRefetchError: false
|
|
852
860
|
isSuccess: true
|
|
861
|
+
isPlaceholderData: false
|
|
862
|
+
status: 'success'
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
export interface QueryObserverPlaceholderResult<
|
|
866
|
+
TData = unknown,
|
|
867
|
+
TError = DefaultError,
|
|
868
|
+
> extends QueryObserverBaseResult<TData, TError> {
|
|
869
|
+
data: TData
|
|
870
|
+
isError: false
|
|
871
|
+
error: null
|
|
872
|
+
isPending: false
|
|
873
|
+
isLoading: false
|
|
874
|
+
isLoadingError: false
|
|
875
|
+
isRefetchError: false
|
|
876
|
+
isSuccess: true
|
|
877
|
+
isPlaceholderData: true
|
|
853
878
|
status: 'success'
|
|
854
879
|
}
|
|
855
880
|
|
|
@@ -865,6 +890,7 @@ export type QueryObserverResult<TData = unknown, TError = DefaultError> =
|
|
|
865
890
|
| QueryObserverLoadingErrorResult<TData, TError>
|
|
866
891
|
| QueryObserverLoadingResult<TData, TError>
|
|
867
892
|
| QueryObserverPendingResult<TData, TError>
|
|
893
|
+
| QueryObserverPlaceholderResult<TData, TError>
|
|
868
894
|
|
|
869
895
|
export interface InfiniteQueryObserverBaseResult<
|
|
870
896
|
TData = unknown,
|
|
@@ -921,6 +947,7 @@ export interface InfiniteQueryObserverPendingResult<
|
|
|
921
947
|
isFetchNextPageError: false
|
|
922
948
|
isFetchPreviousPageError: false
|
|
923
949
|
isSuccess: false
|
|
950
|
+
isPlaceholderData: false
|
|
924
951
|
status: 'pending'
|
|
925
952
|
}
|
|
926
953
|
|
|
@@ -938,6 +965,7 @@ export interface InfiniteQueryObserverLoadingResult<
|
|
|
938
965
|
isFetchNextPageError: false
|
|
939
966
|
isFetchPreviousPageError: false
|
|
940
967
|
isSuccess: false
|
|
968
|
+
isPlaceholderData: false
|
|
941
969
|
status: 'pending'
|
|
942
970
|
}
|
|
943
971
|
|
|
@@ -955,6 +983,7 @@ export interface InfiniteQueryObserverLoadingErrorResult<
|
|
|
955
983
|
isFetchNextPageError: false
|
|
956
984
|
isFetchPreviousPageError: false
|
|
957
985
|
isSuccess: false
|
|
986
|
+
isPlaceholderData: false
|
|
958
987
|
status: 'error'
|
|
959
988
|
}
|
|
960
989
|
|
|
@@ -970,6 +999,7 @@ export interface InfiniteQueryObserverRefetchErrorResult<
|
|
|
970
999
|
isLoadingError: false
|
|
971
1000
|
isRefetchError: true
|
|
972
1001
|
isSuccess: false
|
|
1002
|
+
isPlaceholderData: false
|
|
973
1003
|
status: 'error'
|
|
974
1004
|
}
|
|
975
1005
|
|
|
@@ -987,6 +1017,25 @@ export interface InfiniteQueryObserverSuccessResult<
|
|
|
987
1017
|
isFetchNextPageError: false
|
|
988
1018
|
isFetchPreviousPageError: false
|
|
989
1019
|
isSuccess: true
|
|
1020
|
+
isPlaceholderData: false
|
|
1021
|
+
status: 'success'
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
export interface InfiniteQueryObserverPlaceholderResult<
|
|
1025
|
+
TData = unknown,
|
|
1026
|
+
TError = DefaultError,
|
|
1027
|
+
> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
1028
|
+
data: TData
|
|
1029
|
+
isError: false
|
|
1030
|
+
error: null
|
|
1031
|
+
isPending: false
|
|
1032
|
+
isLoading: false
|
|
1033
|
+
isLoadingError: false
|
|
1034
|
+
isRefetchError: false
|
|
1035
|
+
isSuccess: true
|
|
1036
|
+
isPlaceholderData: true
|
|
1037
|
+
isFetchNextPageError: false
|
|
1038
|
+
isFetchPreviousPageError: false
|
|
990
1039
|
status: 'success'
|
|
991
1040
|
}
|
|
992
1041
|
|
|
@@ -1005,6 +1054,7 @@ export type InfiniteQueryObserverResult<
|
|
|
1005
1054
|
| InfiniteQueryObserverLoadingErrorResult<TData, TError>
|
|
1006
1055
|
| InfiniteQueryObserverLoadingResult<TData, TError>
|
|
1007
1056
|
| InfiniteQueryObserverPendingResult<TData, TError>
|
|
1057
|
+
| InfiniteQueryObserverPlaceholderResult<TData, TError>
|
|
1008
1058
|
|
|
1009
1059
|
export type MutationKey = Register extends {
|
|
1010
1060
|
mutationKey: infer TMutationKey
|