@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.
Files changed (78) hide show
  1. package/build/legacy/hydration.d.cts +1 -1
  2. package/build/legacy/hydration.d.ts +1 -1
  3. package/build/legacy/index.d.cts +1 -1
  4. package/build/legacy/index.d.ts +1 -1
  5. package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
  6. package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
  7. package/build/legacy/infiniteQueryObserver.cjs +14 -7
  8. package/build/legacy/infiniteQueryObserver.cjs.map +1 -1
  9. package/build/legacy/infiniteQueryObserver.d.cts +1 -1
  10. package/build/legacy/infiniteQueryObserver.d.ts +1 -1
  11. package/build/legacy/infiniteQueryObserver.js +14 -7
  12. package/build/legacy/infiniteQueryObserver.js.map +1 -1
  13. package/build/legacy/mutation.d.cts +1 -1
  14. package/build/legacy/mutation.d.ts +1 -1
  15. package/build/legacy/mutationCache.d.cts +1 -1
  16. package/build/legacy/mutationCache.d.ts +1 -1
  17. package/build/legacy/mutationObserver.d.cts +1 -1
  18. package/build/legacy/mutationObserver.d.ts +1 -1
  19. package/build/legacy/queriesObserver.d.cts +1 -1
  20. package/build/legacy/queriesObserver.d.ts +1 -1
  21. package/build/legacy/query.d.cts +1 -1
  22. package/build/legacy/query.d.ts +1 -1
  23. package/build/legacy/queryCache.d.cts +1 -1
  24. package/build/legacy/queryCache.d.ts +1 -1
  25. package/build/legacy/queryClient.d.cts +1 -1
  26. package/build/legacy/queryClient.d.ts +1 -1
  27. package/build/legacy/queryObserver.d.cts +1 -1
  28. package/build/legacy/queryObserver.d.ts +1 -1
  29. package/build/legacy/retryer.d.cts +1 -1
  30. package/build/legacy/retryer.d.ts +1 -1
  31. package/build/legacy/{types-Br-AgPmc.d.ts → types-B0i0SaOM.d.ts} +59 -0
  32. package/build/legacy/{types-Ya7vXgfL.d.cts → types-D3f-7LPM.d.cts} +59 -0
  33. package/build/legacy/types.cjs.map +1 -1
  34. package/build/legacy/types.d.cts +1 -1
  35. package/build/legacy/types.d.ts +1 -1
  36. package/build/legacy/utils.d.cts +1 -1
  37. package/build/legacy/utils.d.ts +1 -1
  38. package/build/modern/hydration.d.cts +1 -1
  39. package/build/modern/hydration.d.ts +1 -1
  40. package/build/modern/index.d.cts +1 -1
  41. package/build/modern/index.d.ts +1 -1
  42. package/build/modern/infiniteQueryBehavior.d.cts +1 -1
  43. package/build/modern/infiniteQueryBehavior.d.ts +1 -1
  44. package/build/modern/infiniteQueryObserver.cjs +13 -6
  45. package/build/modern/infiniteQueryObserver.cjs.map +1 -1
  46. package/build/modern/infiniteQueryObserver.d.cts +1 -1
  47. package/build/modern/infiniteQueryObserver.d.ts +1 -1
  48. package/build/modern/infiniteQueryObserver.js +13 -6
  49. package/build/modern/infiniteQueryObserver.js.map +1 -1
  50. package/build/modern/mutation.d.cts +1 -1
  51. package/build/modern/mutation.d.ts +1 -1
  52. package/build/modern/mutationCache.d.cts +1 -1
  53. package/build/modern/mutationCache.d.ts +1 -1
  54. package/build/modern/mutationObserver.d.cts +1 -1
  55. package/build/modern/mutationObserver.d.ts +1 -1
  56. package/build/modern/queriesObserver.d.cts +1 -1
  57. package/build/modern/queriesObserver.d.ts +1 -1
  58. package/build/modern/query.d.cts +1 -1
  59. package/build/modern/query.d.ts +1 -1
  60. package/build/modern/queryCache.d.cts +1 -1
  61. package/build/modern/queryCache.d.ts +1 -1
  62. package/build/modern/queryClient.d.cts +1 -1
  63. package/build/modern/queryClient.d.ts +1 -1
  64. package/build/modern/queryObserver.d.cts +1 -1
  65. package/build/modern/queryObserver.d.ts +1 -1
  66. package/build/modern/retryer.d.cts +1 -1
  67. package/build/modern/retryer.d.ts +1 -1
  68. package/build/modern/{types-Br-AgPmc.d.ts → types-B0i0SaOM.d.ts} +59 -0
  69. package/build/modern/{types-Ya7vXgfL.d.cts → types-D3f-7LPM.d.cts} +59 -0
  70. package/build/modern/types.cjs.map +1 -1
  71. package/build/modern/types.d.cts +1 -1
  72. package/build/modern/types.d.ts +1 -1
  73. package/build/modern/utils.d.cts +1 -1
  74. package/build/modern/utils.d.ts +1 -1
  75. package/package.json +1 -1
  76. package/src/__tests__/infiniteQueryObserver.test-d.tsx +2 -0
  77. package/src/infiniteQueryObserver.ts +16 -8
  78. package/src/types.ts +59 -0
@@ -1,4 +1,4 @@
1
- import { p as Mutation, o as Query, K as QueryOptions, ay as MutationOptions, b as QueryClient, at as MutationKey, q as MutationState, aw as MutationMeta, av as MutationScope, t as QueryKey, n as QueryState, F as QueryMeta } from './types-Ya7vXgfL.cjs';
1
+ import { p as Mutation, o as Query, K as QueryOptions, ay as MutationOptions, b as QueryClient, at as MutationKey, q as MutationState, aw as MutationMeta, av as MutationScope, t as QueryKey, n as QueryState, F as QueryMeta } from './types-D3f-7LPM.cjs';
2
2
  import './removable.cjs';
3
3
  import './subscribable.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { p as Mutation, o as Query, K as QueryOptions, ay as MutationOptions, b as QueryClient, at as MutationKey, q as MutationState, aw as MutationMeta, av as MutationScope, t as QueryKey, n as QueryState, F as QueryMeta } from './types-Br-AgPmc.js';
1
+ import { p as Mutation, o as Query, K as QueryOptions, ay as MutationOptions, b as QueryClient, at as MutationKey, q as MutationState, aw as MutationMeta, av as MutationScope, t as QueryKey, n as QueryState, F as QueryMeta } from './types-B0i0SaOM.js';
2
2
  import './removable.js';
3
3
  import './subscribable.js';
4
4
 
@@ -1,4 +1,4 @@
1
- export { aK as CancelOptions, C as CancelledError, v as DataTag, D as DefaultError, aJ as DefaultOptions, $ as DefaultedInfiniteQueryObserverOptions, Z as DefaultedQueryObserverOptions, ar as DefinedInfiniteQueryObserverResult, aj as DefinedQueryObserverResult, a1 as EnsureQueryDataOptions, a2 as FetchInfiniteQueryOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, a0 as FetchQueryOptions, ac as FetchStatus, B as GetNextPageParamFunction, G as GetPreviousPageParamFunction, E as InfiniteData, al as InfiniteQueryObserverBaseResult, ao as InfiniteQueryObserverLoadingErrorResult, an as InfiniteQueryObserverLoadingResult, _ as InfiniteQueryObserverOptions, am as InfiniteQueryObserverPendingResult, ap as InfiniteQueryObserverRefetchErrorResult, as as InfiniteQueryObserverResult, aq as InfiniteQueryObserverSuccessResult, T as InfiniteQueryPageParamsOptions, I as InitialDataFunction, L as InitialPageParam, a7 as InvalidateOptions, a5 as InvalidateQueryFilters, aB as MutateFunction, aA as MutateOptions, p as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, ax as MutationFunction, at as MutationKey, aw as MutationMeta, e as MutationObserver, aC as MutationObserverBaseResult, aF as MutationObserverErrorResult, aD as MutationObserverIdleResult, aE as MutationObserverLoadingResult, az as MutationObserverOptions, aH as MutationObserverResult, aG as MutationObserverSuccessResult, ay as MutationOptions, av as MutationScope, q as MutationState, au as MutationStatus, H as NetworkMode, N as NoInfer, aN as NotifyEvent, aM as NotifyEventType, J as NotifyOnChangeProps, O as OmitKeyof, Y as Optional, P as PlaceholderDataFunction, z as QueriesPlaceholderDataFunction, o as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, aI as QueryClientConfig, j as QueryFilters, w as QueryFunction, y as QueryFunctionContext, t as QueryKey, A as QueryKeyHashFunction, F as QueryMeta, c as QueryObserver, ad as QueryObserverBaseResult, ag as QueryObserverLoadingErrorResult, af as QueryObserverLoadingResult, W as QueryObserverOptions, ae as QueryObserverPendingResult, ah as QueryObserverRefetchErrorResult, ak as QueryObserverResult, ai as QueryObserverSuccessResult, K as QueryOptions, x as QueryPersister, n as QueryState, ab as QueryStatus, a4 as RefetchOptions, a6 as RefetchQueryFilters, R as Register, a8 as ResetOptions, a3 as ResultOptions, aL as SetDataOptions, S as SkipToken, V as ThrowOnError, U as Updater, X as WithRequired, u as dataTagSymbol, h as hashKey, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken } from './types-Ya7vXgfL.cjs';
1
+ export { aK as CancelOptions, C as CancelledError, v as DataTag, D as DefaultError, aJ as DefaultOptions, $ as DefaultedInfiniteQueryObserverOptions, Z as DefaultedQueryObserverOptions, ar as DefinedInfiniteQueryObserverResult, aj as DefinedQueryObserverResult, a1 as EnsureQueryDataOptions, a2 as FetchInfiniteQueryOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, a0 as FetchQueryOptions, ac as FetchStatus, B as GetNextPageParamFunction, G as GetPreviousPageParamFunction, E as InfiniteData, al as InfiniteQueryObserverBaseResult, ao as InfiniteQueryObserverLoadingErrorResult, an as InfiniteQueryObserverLoadingResult, _ as InfiniteQueryObserverOptions, am as InfiniteQueryObserverPendingResult, ap as InfiniteQueryObserverRefetchErrorResult, as as InfiniteQueryObserverResult, aq as InfiniteQueryObserverSuccessResult, T as InfiniteQueryPageParamsOptions, I as InitialDataFunction, L as InitialPageParam, a7 as InvalidateOptions, a5 as InvalidateQueryFilters, aB as MutateFunction, aA as MutateOptions, p as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, ax as MutationFunction, at as MutationKey, aw as MutationMeta, e as MutationObserver, aC as MutationObserverBaseResult, aF as MutationObserverErrorResult, aD as MutationObserverIdleResult, aE as MutationObserverLoadingResult, az as MutationObserverOptions, aH as MutationObserverResult, aG as MutationObserverSuccessResult, ay as MutationOptions, av as MutationScope, q as MutationState, au as MutationStatus, H as NetworkMode, N as NoInfer, aN as NotifyEvent, aM as NotifyEventType, J as NotifyOnChangeProps, O as OmitKeyof, Y as Optional, P as PlaceholderDataFunction, z as QueriesPlaceholderDataFunction, o as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, aI as QueryClientConfig, j as QueryFilters, w as QueryFunction, y as QueryFunctionContext, t as QueryKey, A as QueryKeyHashFunction, F as QueryMeta, c as QueryObserver, ad as QueryObserverBaseResult, ag as QueryObserverLoadingErrorResult, af as QueryObserverLoadingResult, W as QueryObserverOptions, ae as QueryObserverPendingResult, ah as QueryObserverRefetchErrorResult, ak as QueryObserverResult, ai as QueryObserverSuccessResult, K as QueryOptions, x as QueryPersister, n as QueryState, ab as QueryStatus, a4 as RefetchOptions, a6 as RefetchQueryFilters, R as Register, a8 as ResetOptions, a3 as ResultOptions, aL as SetDataOptions, S as SkipToken, V as ThrowOnError, U as Updater, X as WithRequired, u as dataTagSymbol, h as hashKey, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken } from './types-D3f-7LPM.cjs';
2
2
  export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.cjs';
3
3
  export { InfiniteQueryObserver } from './infiniteQueryObserver.cjs';
4
4
  export { notifyManager } from './notifyManager.cjs';
@@ -1,4 +1,4 @@
1
- export { aK as CancelOptions, C as CancelledError, v as DataTag, D as DefaultError, aJ as DefaultOptions, $ as DefaultedInfiniteQueryObserverOptions, Z as DefaultedQueryObserverOptions, ar as DefinedInfiniteQueryObserverResult, aj as DefinedQueryObserverResult, a1 as EnsureQueryDataOptions, a2 as FetchInfiniteQueryOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, a0 as FetchQueryOptions, ac as FetchStatus, B as GetNextPageParamFunction, G as GetPreviousPageParamFunction, E as InfiniteData, al as InfiniteQueryObserverBaseResult, ao as InfiniteQueryObserverLoadingErrorResult, an as InfiniteQueryObserverLoadingResult, _ as InfiniteQueryObserverOptions, am as InfiniteQueryObserverPendingResult, ap as InfiniteQueryObserverRefetchErrorResult, as as InfiniteQueryObserverResult, aq as InfiniteQueryObserverSuccessResult, T as InfiniteQueryPageParamsOptions, I as InitialDataFunction, L as InitialPageParam, a7 as InvalidateOptions, a5 as InvalidateQueryFilters, aB as MutateFunction, aA as MutateOptions, p as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, ax as MutationFunction, at as MutationKey, aw as MutationMeta, e as MutationObserver, aC as MutationObserverBaseResult, aF as MutationObserverErrorResult, aD as MutationObserverIdleResult, aE as MutationObserverLoadingResult, az as MutationObserverOptions, aH as MutationObserverResult, aG as MutationObserverSuccessResult, ay as MutationOptions, av as MutationScope, q as MutationState, au as MutationStatus, H as NetworkMode, N as NoInfer, aN as NotifyEvent, aM as NotifyEventType, J as NotifyOnChangeProps, O as OmitKeyof, Y as Optional, P as PlaceholderDataFunction, z as QueriesPlaceholderDataFunction, o as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, aI as QueryClientConfig, j as QueryFilters, w as QueryFunction, y as QueryFunctionContext, t as QueryKey, A as QueryKeyHashFunction, F as QueryMeta, c as QueryObserver, ad as QueryObserverBaseResult, ag as QueryObserverLoadingErrorResult, af as QueryObserverLoadingResult, W as QueryObserverOptions, ae as QueryObserverPendingResult, ah as QueryObserverRefetchErrorResult, ak as QueryObserverResult, ai as QueryObserverSuccessResult, K as QueryOptions, x as QueryPersister, n as QueryState, ab as QueryStatus, a4 as RefetchOptions, a6 as RefetchQueryFilters, R as Register, a8 as ResetOptions, a3 as ResultOptions, aL as SetDataOptions, S as SkipToken, V as ThrowOnError, U as Updater, X as WithRequired, u as dataTagSymbol, h as hashKey, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken } from './types-Br-AgPmc.js';
1
+ export { aK as CancelOptions, C as CancelledError, v as DataTag, D as DefaultError, aJ as DefaultOptions, $ as DefaultedInfiniteQueryObserverOptions, Z as DefaultedQueryObserverOptions, ar as DefinedInfiniteQueryObserverResult, aj as DefinedQueryObserverResult, a1 as EnsureQueryDataOptions, a2 as FetchInfiniteQueryOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, a0 as FetchQueryOptions, ac as FetchStatus, B as GetNextPageParamFunction, G as GetPreviousPageParamFunction, E as InfiniteData, al as InfiniteQueryObserverBaseResult, ao as InfiniteQueryObserverLoadingErrorResult, an as InfiniteQueryObserverLoadingResult, _ as InfiniteQueryObserverOptions, am as InfiniteQueryObserverPendingResult, ap as InfiniteQueryObserverRefetchErrorResult, as as InfiniteQueryObserverResult, aq as InfiniteQueryObserverSuccessResult, T as InfiniteQueryPageParamsOptions, I as InitialDataFunction, L as InitialPageParam, a7 as InvalidateOptions, a5 as InvalidateQueryFilters, aB as MutateFunction, aA as MutateOptions, p as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, g as MutationFilters, ax as MutationFunction, at as MutationKey, aw as MutationMeta, e as MutationObserver, aC as MutationObserverBaseResult, aF as MutationObserverErrorResult, aD as MutationObserverIdleResult, aE as MutationObserverLoadingResult, az as MutationObserverOptions, aH as MutationObserverResult, aG as MutationObserverSuccessResult, ay as MutationOptions, av as MutationScope, q as MutationState, au as MutationStatus, H as NetworkMode, N as NoInfer, aN as NotifyEvent, aM as NotifyEventType, J as NotifyOnChangeProps, O as OmitKeyof, Y as Optional, P as PlaceholderDataFunction, z as QueriesPlaceholderDataFunction, o as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, aI as QueryClientConfig, j as QueryFilters, w as QueryFunction, y as QueryFunctionContext, t as QueryKey, A as QueryKeyHashFunction, F as QueryMeta, c as QueryObserver, ad as QueryObserverBaseResult, ag as QueryObserverLoadingErrorResult, af as QueryObserverLoadingResult, W as QueryObserverOptions, ae as QueryObserverPendingResult, ah as QueryObserverRefetchErrorResult, ak as QueryObserverResult, ai as QueryObserverSuccessResult, K as QueryOptions, x as QueryPersister, n as QueryState, ab as QueryStatus, a4 as RefetchOptions, a6 as RefetchQueryFilters, R as Register, a8 as ResetOptions, a3 as ResultOptions, aL as SetDataOptions, S as SkipToken, V as ThrowOnError, U as Updater, X as WithRequired, u as dataTagSymbol, h as hashKey, l as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, r as replaceEqualDeep, s as skipToken } from './types-B0i0SaOM.js';
2
2
  export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.js';
3
3
  export { InfiniteQueryObserver } from './infiniteQueryObserver.js';
4
4
  export { notifyManager } from './notifyManager.js';
@@ -1,4 +1,4 @@
1
- import { aO as QueryBehavior, E as InfiniteData, T as InfiniteQueryPageParamsOptions } from './types-Ya7vXgfL.cjs';
1
+ import { aO as QueryBehavior, E as InfiniteData, T as InfiniteQueryPageParamsOptions } from './types-D3f-7LPM.cjs';
2
2
  import './removable.cjs';
3
3
  import './subscribable.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { aO as QueryBehavior, E as InfiniteData, T as InfiniteQueryPageParamsOptions } from './types-Br-AgPmc.js';
1
+ import { aO as QueryBehavior, E as InfiniteData, T as InfiniteQueryPageParamsOptions } from './types-B0i0SaOM.js';
2
2
  import './removable.js';
3
3
  import './subscribable.js';
4
4
 
@@ -64,22 +64,29 @@ var InfiniteQueryObserver = class extends import_queryObserver.QueryObserver {
64
64
  });
65
65
  }
66
66
  createResult(query, options) {
67
- var _a, _b, _c, _d;
67
+ var _a, _b;
68
68
  const { state } = query;
69
- const result = super.createResult(query, options);
70
- const { isFetching, isRefetching } = result;
71
- const isFetchingNextPage = isFetching && ((_b = (_a = state.fetchMeta) == null ? void 0 : _a.fetchMore) == null ? void 0 : _b.direction) === "forward";
72
- const isFetchingPreviousPage = isFetching && ((_d = (_c = state.fetchMeta) == null ? void 0 : _c.fetchMore) == null ? void 0 : _d.direction) === "backward";
73
- return {
74
- ...result,
69
+ const parentResult = super.createResult(query, options);
70
+ const { isFetching, isRefetching, isError, isRefetchError } = parentResult;
71
+ const fetchDirection = (_b = (_a = state.fetchMeta) == null ? void 0 : _a.fetchMore) == null ? void 0 : _b.direction;
72
+ const isFetchNextPageError = isError && fetchDirection === "forward";
73
+ const isFetchingNextPage = isFetching && fetchDirection === "forward";
74
+ const isFetchPreviousPageError = isError && fetchDirection === "backward";
75
+ const isFetchingPreviousPage = isFetching && fetchDirection === "backward";
76
+ const result = {
77
+ ...parentResult,
75
78
  fetchNextPage: this.fetchNextPage,
76
79
  fetchPreviousPage: this.fetchPreviousPage,
77
80
  hasNextPage: (0, import_infiniteQueryBehavior.hasNextPage)(options, state.data),
78
81
  hasPreviousPage: (0, import_infiniteQueryBehavior.hasPreviousPage)(options, state.data),
82
+ isFetchNextPageError,
79
83
  isFetchingNextPage,
84
+ isFetchPreviousPageError,
80
85
  isFetchingPreviousPage,
86
+ isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,
81
87
  isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage
82
88
  };
89
+ return result;
83
90
  }
84
91
  };
85
92
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/infiniteQueryObserver.ts"],"sourcesContent":["import { QueryObserver } from './queryObserver'\nimport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior,\n} from './infiniteQueryBehavior'\nimport type {\n DefaultError,\n DefaultedInfiniteQueryObserverOptions,\n FetchNextPageOptions,\n FetchPreviousPageOptions,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { NotifyOptions, ObserverFetchOptions } from './queryObserver'\nimport type { Query } from './query'\n\ntype InfiniteQueryObserverListener<TData, TError> = (\n result: InfiniteQueryObserverResult<TData, TError>,\n) => void\n\nexport class InfiniteQueryObserver<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends QueryObserver<\n TQueryFnData,\n TError,\n TData,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n> {\n // Type override\n subscribe!: (\n listener?: InfiniteQueryObserverListener<TData, TError>,\n ) => () => void\n\n // Type override\n getCurrentResult!: () => InfiniteQueryObserverResult<TData, TError>\n\n // Type override\n protected fetch!: (\n fetchOptions: ObserverFetchOptions,\n ) => Promise<InfiniteQueryObserverResult<TData, TError>>\n\n constructor(\n client: QueryClient,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ) {\n super(client, options)\n }\n\n protected bindMethods(): void {\n super.bindMethods()\n this.fetchNextPage = this.fetchNextPage.bind(this)\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this)\n }\n\n setOptions(\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n notifyOptions?: NotifyOptions,\n ): void {\n super.setOptions(\n {\n ...options,\n behavior: infiniteQueryBehavior(),\n },\n notifyOptions,\n )\n }\n\n getOptimisticResult(\n options: DefaultedInfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n options.behavior = infiniteQueryBehavior()\n return super.getOptimisticResult(options) as InfiniteQueryObserverResult<\n TData,\n TError\n >\n }\n\n fetchNextPage(\n options?: FetchNextPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'forward' },\n },\n })\n }\n\n fetchPreviousPage(\n options?: FetchPreviousPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'backward' },\n },\n })\n }\n\n protected createResult(\n query: Query<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n const { state } = query\n const result = super.createResult(query, options)\n\n const { isFetching, isRefetching } = result\n\n const isFetchingNextPage =\n isFetching && state.fetchMeta?.fetchMore?.direction === 'forward'\n\n const isFetchingPreviousPage =\n isFetching && state.fetchMeta?.fetchMore?.direction === 'backward'\n\n return {\n ...result,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, state.data),\n hasPreviousPage: hasPreviousPage(options, state.data),\n isFetchingNextPage,\n isFetchingPreviousPage,\n isRefetching:\n isRefetching && !isFetchingNextPage && !isFetchingPreviousPage,\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8B;AAC9B,mCAIO;AAmBA,IAAM,wBAAN,cAOG,mCAMR;AAAA,EAcA,YACE,QACA,SAQA;AACA,UAAM,QAAQ,OAAO;AAAA,EACvB;AAAA,EAEU,cAAoB;AAC5B,UAAM,YAAY;AAClB,SAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI;AACjD,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AAAA,EAC3D;AAAA,EAEA,WACE,SAQA,eACM;AACN,UAAM;AAAA,MACJ;AAAA,QACE,GAAG;AAAA,QACH,cAAU,oDAAsB;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,oBACE,SAQ4C;AAC5C,YAAQ,eAAW,oDAAsB;AACzC,WAAO,MAAM,oBAAoB,OAAO;AAAA,EAI1C;AAAA,EAEA,cACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,UAAU;AAAA,MACpC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,kBACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,WAAW;AAAA,MACrC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEU,aACR,OAMA,SAQ4C;AAjJhD;AAkJI,UAAM,EAAE,MAAM,IAAI;AAClB,UAAM,SAAS,MAAM,aAAa,OAAO,OAAO;AAEhD,UAAM,EAAE,YAAY,aAAa,IAAI;AAErC,UAAM,qBACJ,gBAAc,iBAAM,cAAN,mBAAiB,cAAjB,mBAA4B,eAAc;AAE1D,UAAM,yBACJ,gBAAc,iBAAM,cAAN,mBAAiB,cAAjB,mBAA4B,eAAc;AAE1D,WAAO;AAAA,MACL,GAAG;AAAA,MACH,eAAe,KAAK;AAAA,MACpB,mBAAmB,KAAK;AAAA,MACxB,iBAAa,0CAAY,SAAS,MAAM,IAAI;AAAA,MAC5C,qBAAiB,8CAAgB,SAAS,MAAM,IAAI;AAAA,MACpD;AAAA,MACA;AAAA,MACA,cACE,gBAAgB,CAAC,sBAAsB,CAAC;AAAA,IAC5C;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/infiniteQueryObserver.ts"],"sourcesContent":["import { QueryObserver } from './queryObserver'\nimport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior,\n} from './infiniteQueryBehavior'\nimport type {\n DefaultError,\n DefaultedInfiniteQueryObserverOptions,\n FetchNextPageOptions,\n FetchPreviousPageOptions,\n InfiniteData,\n InfiniteQueryObserverBaseResult,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { NotifyOptions, ObserverFetchOptions } from './queryObserver'\nimport type { Query } from './query'\n\ntype InfiniteQueryObserverListener<TData, TError> = (\n result: InfiniteQueryObserverResult<TData, TError>,\n) => void\n\nexport class InfiniteQueryObserver<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends QueryObserver<\n TQueryFnData,\n TError,\n TData,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n> {\n // Type override\n subscribe!: (\n listener?: InfiniteQueryObserverListener<TData, TError>,\n ) => () => void\n\n // Type override\n getCurrentResult!: () => InfiniteQueryObserverResult<TData, TError>\n\n // Type override\n protected fetch!: (\n fetchOptions: ObserverFetchOptions,\n ) => Promise<InfiniteQueryObserverResult<TData, TError>>\n\n constructor(\n client: QueryClient,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ) {\n super(client, options)\n }\n\n protected bindMethods(): void {\n super.bindMethods()\n this.fetchNextPage = this.fetchNextPage.bind(this)\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this)\n }\n\n setOptions(\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n notifyOptions?: NotifyOptions,\n ): void {\n super.setOptions(\n {\n ...options,\n behavior: infiniteQueryBehavior(),\n },\n notifyOptions,\n )\n }\n\n getOptimisticResult(\n options: DefaultedInfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n options.behavior = infiniteQueryBehavior()\n return super.getOptimisticResult(options) as InfiniteQueryObserverResult<\n TData,\n TError\n >\n }\n\n fetchNextPage(\n options?: FetchNextPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'forward' },\n },\n })\n }\n\n fetchPreviousPage(\n options?: FetchPreviousPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'backward' },\n },\n })\n }\n\n protected createResult(\n query: Query<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n const { state } = query\n const parentResult = super.createResult(query, options)\n\n const { isFetching, isRefetching, isError, isRefetchError } = parentResult\n const fetchDirection = state.fetchMeta?.fetchMore?.direction\n\n const isFetchNextPageError = isError && fetchDirection === 'forward'\n const isFetchingNextPage = isFetching && fetchDirection === 'forward'\n\n const isFetchPreviousPageError = isError && fetchDirection === 'backward'\n const isFetchingPreviousPage = isFetching && fetchDirection === 'backward'\n\n const result: InfiniteQueryObserverBaseResult<TData, TError> = {\n ...parentResult,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, state.data),\n hasPreviousPage: hasPreviousPage(options, state.data),\n isFetchNextPageError,\n isFetchingNextPage,\n isFetchPreviousPageError,\n isFetchingPreviousPage,\n isRefetchError:\n isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,\n isRefetching:\n isRefetching && !isFetchingNextPage && !isFetchingPreviousPage,\n }\n\n return result as InfiniteQueryObserverResult<TData, TError>\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8B;AAC9B,mCAIO;AAoBA,IAAM,wBAAN,cAOG,mCAMR;AAAA,EAcA,YACE,QACA,SAQA;AACA,UAAM,QAAQ,OAAO;AAAA,EACvB;AAAA,EAEU,cAAoB;AAC5B,UAAM,YAAY;AAClB,SAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI;AACjD,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AAAA,EAC3D;AAAA,EAEA,WACE,SAQA,eACM;AACN,UAAM;AAAA,MACJ;AAAA,QACE,GAAG;AAAA,QACH,cAAU,oDAAsB;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,oBACE,SAQ4C;AAC5C,YAAQ,eAAW,oDAAsB;AACzC,WAAO,MAAM,oBAAoB,OAAO;AAAA,EAI1C;AAAA,EAEA,cACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,UAAU;AAAA,MACpC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,kBACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,WAAW;AAAA,MACrC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEU,aACR,OAMA,SAQ4C;AAlJhD;AAmJI,UAAM,EAAE,MAAM,IAAI;AAClB,UAAM,eAAe,MAAM,aAAa,OAAO,OAAO;AAEtD,UAAM,EAAE,YAAY,cAAc,SAAS,eAAe,IAAI;AAC9D,UAAM,kBAAiB,iBAAM,cAAN,mBAAiB,cAAjB,mBAA4B;AAEnD,UAAM,uBAAuB,WAAW,mBAAmB;AAC3D,UAAM,qBAAqB,cAAc,mBAAmB;AAE5D,UAAM,2BAA2B,WAAW,mBAAmB;AAC/D,UAAM,yBAAyB,cAAc,mBAAmB;AAEhE,UAAM,SAAyD;AAAA,MAC7D,GAAG;AAAA,MACH,eAAe,KAAK;AAAA,MACpB,mBAAmB,KAAK;AAAA,MACxB,iBAAa,0CAAY,SAAS,MAAM,IAAI;AAAA,MAC5C,qBAAiB,8CAAgB,SAAS,MAAM,IAAI;AAAA,MACpD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBACE,kBAAkB,CAAC,wBAAwB,CAAC;AAAA,MAC9C,cACE,gBAAgB,CAAC,sBAAsB,CAAC;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,4 +1,4 @@
1
- import { D as DefaultError, E as InfiniteData, t as QueryKey, c as QueryObserver, as as InfiniteQueryObserverResult, aP as ObserverFetchOptions, b as QueryClient, _ as InfiniteQueryObserverOptions, aQ as NotifyOptions, $ as DefaultedInfiniteQueryObserverOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, o as Query } from './types-Ya7vXgfL.cjs';
1
+ import { D as DefaultError, E as InfiniteData, t as QueryKey, c as QueryObserver, as as InfiniteQueryObserverResult, aP as ObserverFetchOptions, b as QueryClient, _ as InfiniteQueryObserverOptions, aQ as NotifyOptions, $ as DefaultedInfiniteQueryObserverOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, o as Query } from './types-D3f-7LPM.cjs';
2
2
  import './removable.cjs';
3
3
  import './subscribable.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { D as DefaultError, E as InfiniteData, t as QueryKey, c as QueryObserver, as as InfiniteQueryObserverResult, aP as ObserverFetchOptions, b as QueryClient, _ as InfiniteQueryObserverOptions, aQ as NotifyOptions, $ as DefaultedInfiniteQueryObserverOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, o as Query } from './types-Br-AgPmc.js';
1
+ import { D as DefaultError, E as InfiniteData, t as QueryKey, c as QueryObserver, as as InfiniteQueryObserverResult, aP as ObserverFetchOptions, b as QueryClient, _ as InfiniteQueryObserverOptions, aQ as NotifyOptions, $ as DefaultedInfiniteQueryObserverOptions, a9 as FetchNextPageOptions, aa as FetchPreviousPageOptions, o as Query } from './types-B0i0SaOM.js';
2
2
  import './removable.js';
3
3
  import './subscribable.js';
4
4
 
@@ -46,22 +46,29 @@ var InfiniteQueryObserver = class extends QueryObserver {
46
46
  });
47
47
  }
48
48
  createResult(query, options) {
49
- var _a, _b, _c, _d;
49
+ var _a, _b;
50
50
  const { state } = query;
51
- const result = super.createResult(query, options);
52
- const { isFetching, isRefetching } = result;
53
- const isFetchingNextPage = isFetching && ((_b = (_a = state.fetchMeta) == null ? void 0 : _a.fetchMore) == null ? void 0 : _b.direction) === "forward";
54
- const isFetchingPreviousPage = isFetching && ((_d = (_c = state.fetchMeta) == null ? void 0 : _c.fetchMore) == null ? void 0 : _d.direction) === "backward";
55
- return {
56
- ...result,
51
+ const parentResult = super.createResult(query, options);
52
+ const { isFetching, isRefetching, isError, isRefetchError } = parentResult;
53
+ const fetchDirection = (_b = (_a = state.fetchMeta) == null ? void 0 : _a.fetchMore) == null ? void 0 : _b.direction;
54
+ const isFetchNextPageError = isError && fetchDirection === "forward";
55
+ const isFetchingNextPage = isFetching && fetchDirection === "forward";
56
+ const isFetchPreviousPageError = isError && fetchDirection === "backward";
57
+ const isFetchingPreviousPage = isFetching && fetchDirection === "backward";
58
+ const result = {
59
+ ...parentResult,
57
60
  fetchNextPage: this.fetchNextPage,
58
61
  fetchPreviousPage: this.fetchPreviousPage,
59
62
  hasNextPage: hasNextPage(options, state.data),
60
63
  hasPreviousPage: hasPreviousPage(options, state.data),
64
+ isFetchNextPageError,
61
65
  isFetchingNextPage,
66
+ isFetchPreviousPageError,
62
67
  isFetchingPreviousPage,
68
+ isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,
63
69
  isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage
64
70
  };
71
+ return result;
65
72
  }
66
73
  };
67
74
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/infiniteQueryObserver.ts"],"sourcesContent":["import { QueryObserver } from './queryObserver'\nimport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior,\n} from './infiniteQueryBehavior'\nimport type {\n DefaultError,\n DefaultedInfiniteQueryObserverOptions,\n FetchNextPageOptions,\n FetchPreviousPageOptions,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { NotifyOptions, ObserverFetchOptions } from './queryObserver'\nimport type { Query } from './query'\n\ntype InfiniteQueryObserverListener<TData, TError> = (\n result: InfiniteQueryObserverResult<TData, TError>,\n) => void\n\nexport class InfiniteQueryObserver<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends QueryObserver<\n TQueryFnData,\n TError,\n TData,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n> {\n // Type override\n subscribe!: (\n listener?: InfiniteQueryObserverListener<TData, TError>,\n ) => () => void\n\n // Type override\n getCurrentResult!: () => InfiniteQueryObserverResult<TData, TError>\n\n // Type override\n protected fetch!: (\n fetchOptions: ObserverFetchOptions,\n ) => Promise<InfiniteQueryObserverResult<TData, TError>>\n\n constructor(\n client: QueryClient,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ) {\n super(client, options)\n }\n\n protected bindMethods(): void {\n super.bindMethods()\n this.fetchNextPage = this.fetchNextPage.bind(this)\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this)\n }\n\n setOptions(\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n notifyOptions?: NotifyOptions,\n ): void {\n super.setOptions(\n {\n ...options,\n behavior: infiniteQueryBehavior(),\n },\n notifyOptions,\n )\n }\n\n getOptimisticResult(\n options: DefaultedInfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n options.behavior = infiniteQueryBehavior()\n return super.getOptimisticResult(options) as InfiniteQueryObserverResult<\n TData,\n TError\n >\n }\n\n fetchNextPage(\n options?: FetchNextPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'forward' },\n },\n })\n }\n\n fetchPreviousPage(\n options?: FetchPreviousPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'backward' },\n },\n })\n }\n\n protected createResult(\n query: Query<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n const { state } = query\n const result = super.createResult(query, options)\n\n const { isFetching, isRefetching } = result\n\n const isFetchingNextPage =\n isFetching && state.fetchMeta?.fetchMore?.direction === 'forward'\n\n const isFetchingPreviousPage =\n isFetching && state.fetchMeta?.fetchMore?.direction === 'backward'\n\n return {\n ...result,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, state.data),\n hasPreviousPage: hasPreviousPage(options, state.data),\n isFetchingNextPage,\n isFetchingPreviousPage,\n isRefetching:\n isRefetching && !isFetchingNextPage && !isFetchingPreviousPage,\n }\n }\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAmBA,IAAM,wBAAN,cAOG,cAMR;AAAA,EAcA,YACE,QACA,SAQA;AACA,UAAM,QAAQ,OAAO;AAAA,EACvB;AAAA,EAEU,cAAoB;AAC5B,UAAM,YAAY;AAClB,SAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI;AACjD,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AAAA,EAC3D;AAAA,EAEA,WACE,SAQA,eACM;AACN,UAAM;AAAA,MACJ;AAAA,QACE,GAAG;AAAA,QACH,UAAU,sBAAsB;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,oBACE,SAQ4C;AAC5C,YAAQ,WAAW,sBAAsB;AACzC,WAAO,MAAM,oBAAoB,OAAO;AAAA,EAI1C;AAAA,EAEA,cACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,UAAU;AAAA,MACpC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,kBACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,WAAW;AAAA,MACrC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEU,aACR,OAMA,SAQ4C;AAjJhD;AAkJI,UAAM,EAAE,MAAM,IAAI;AAClB,UAAM,SAAS,MAAM,aAAa,OAAO,OAAO;AAEhD,UAAM,EAAE,YAAY,aAAa,IAAI;AAErC,UAAM,qBACJ,gBAAc,iBAAM,cAAN,mBAAiB,cAAjB,mBAA4B,eAAc;AAE1D,UAAM,yBACJ,gBAAc,iBAAM,cAAN,mBAAiB,cAAjB,mBAA4B,eAAc;AAE1D,WAAO;AAAA,MACL,GAAG;AAAA,MACH,eAAe,KAAK;AAAA,MACpB,mBAAmB,KAAK;AAAA,MACxB,aAAa,YAAY,SAAS,MAAM,IAAI;AAAA,MAC5C,iBAAiB,gBAAgB,SAAS,MAAM,IAAI;AAAA,MACpD;AAAA,MACA;AAAA,MACA,cACE,gBAAgB,CAAC,sBAAsB,CAAC;AAAA,IAC5C;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/infiniteQueryObserver.ts"],"sourcesContent":["import { QueryObserver } from './queryObserver'\nimport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior,\n} from './infiniteQueryBehavior'\nimport type {\n DefaultError,\n DefaultedInfiniteQueryObserverOptions,\n FetchNextPageOptions,\n FetchPreviousPageOptions,\n InfiniteData,\n InfiniteQueryObserverBaseResult,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryKey,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { NotifyOptions, ObserverFetchOptions } from './queryObserver'\nimport type { Query } from './query'\n\ntype InfiniteQueryObserverListener<TData, TError> = (\n result: InfiniteQueryObserverResult<TData, TError>,\n) => void\n\nexport class InfiniteQueryObserver<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends QueryObserver<\n TQueryFnData,\n TError,\n TData,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n> {\n // Type override\n subscribe!: (\n listener?: InfiniteQueryObserverListener<TData, TError>,\n ) => () => void\n\n // Type override\n getCurrentResult!: () => InfiniteQueryObserverResult<TData, TError>\n\n // Type override\n protected fetch!: (\n fetchOptions: ObserverFetchOptions,\n ) => Promise<InfiniteQueryObserverResult<TData, TError>>\n\n constructor(\n client: QueryClient,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ) {\n super(client, options)\n }\n\n protected bindMethods(): void {\n super.bindMethods()\n this.fetchNextPage = this.fetchNextPage.bind(this)\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this)\n }\n\n setOptions(\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n notifyOptions?: NotifyOptions,\n ): void {\n super.setOptions(\n {\n ...options,\n behavior: infiniteQueryBehavior(),\n },\n notifyOptions,\n )\n }\n\n getOptimisticResult(\n options: DefaultedInfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n options.behavior = infiniteQueryBehavior()\n return super.getOptimisticResult(options) as InfiniteQueryObserverResult<\n TData,\n TError\n >\n }\n\n fetchNextPage(\n options?: FetchNextPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'forward' },\n },\n })\n }\n\n fetchPreviousPage(\n options?: FetchPreviousPageOptions,\n ): Promise<InfiniteQueryObserverResult<TData, TError>> {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: 'backward' },\n },\n })\n }\n\n protected createResult(\n query: Query<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >,\n options: InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n ): InfiniteQueryObserverResult<TData, TError> {\n const { state } = query\n const parentResult = super.createResult(query, options)\n\n const { isFetching, isRefetching, isError, isRefetchError } = parentResult\n const fetchDirection = state.fetchMeta?.fetchMore?.direction\n\n const isFetchNextPageError = isError && fetchDirection === 'forward'\n const isFetchingNextPage = isFetching && fetchDirection === 'forward'\n\n const isFetchPreviousPageError = isError && fetchDirection === 'backward'\n const isFetchingPreviousPage = isFetching && fetchDirection === 'backward'\n\n const result: InfiniteQueryObserverBaseResult<TData, TError> = {\n ...parentResult,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, state.data),\n hasPreviousPage: hasPreviousPage(options, state.data),\n isFetchNextPageError,\n isFetchingNextPage,\n isFetchPreviousPageError,\n isFetchingPreviousPage,\n isRefetchError:\n isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,\n isRefetching:\n isRefetching && !isFetchingNextPage && !isFetchingPreviousPage,\n }\n\n return result as InfiniteQueryObserverResult<TData, TError>\n }\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAoBA,IAAM,wBAAN,cAOG,cAMR;AAAA,EAcA,YACE,QACA,SAQA;AACA,UAAM,QAAQ,OAAO;AAAA,EACvB;AAAA,EAEU,cAAoB;AAC5B,UAAM,YAAY;AAClB,SAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI;AACjD,SAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AAAA,EAC3D;AAAA,EAEA,WACE,SAQA,eACM;AACN,UAAM;AAAA,MACJ;AAAA,QACE,GAAG;AAAA,QACH,UAAU,sBAAsB;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,oBACE,SAQ4C;AAC5C,YAAQ,WAAW,sBAAsB;AACzC,WAAO,MAAM,oBAAoB,OAAO;AAAA,EAI1C;AAAA,EAEA,cACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,UAAU;AAAA,MACpC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,kBACE,SACqD;AACrD,WAAO,KAAK,MAAM;AAAA,MAChB,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,WAAW;AAAA,MACrC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEU,aACR,OAMA,SAQ4C;AAlJhD;AAmJI,UAAM,EAAE,MAAM,IAAI;AAClB,UAAM,eAAe,MAAM,aAAa,OAAO,OAAO;AAEtD,UAAM,EAAE,YAAY,cAAc,SAAS,eAAe,IAAI;AAC9D,UAAM,kBAAiB,iBAAM,cAAN,mBAAiB,cAAjB,mBAA4B;AAEnD,UAAM,uBAAuB,WAAW,mBAAmB;AAC3D,UAAM,qBAAqB,cAAc,mBAAmB;AAE5D,UAAM,2BAA2B,WAAW,mBAAmB;AAC/D,UAAM,yBAAyB,cAAc,mBAAmB;AAEhE,UAAM,SAAyD;AAAA,MAC7D,GAAG;AAAA,MACH,eAAe,KAAK;AAAA,MACpB,mBAAmB,KAAK;AAAA,MACxB,aAAa,YAAY,SAAS,MAAM,IAAI;AAAA,MAC5C,iBAAiB,gBAAgB,SAAS,MAAM,IAAI;AAAA,MACpD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBACE,kBAAkB,CAAC,wBAAwB,CAAC;AAAA,MAC9C,cACE,gBAAgB,CAAC,sBAAsB,CAAC;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,3 +1,3 @@
1
1
  import './removable.cjs';
2
- export { bb as Action, p as Mutation, q as MutationState, bc as getDefaultState } from './types-Ya7vXgfL.cjs';
2
+ export { bb as Action, p as Mutation, q as MutationState, bc as getDefaultState } from './types-D3f-7LPM.cjs';
3
3
  import './subscribable.cjs';
@@ -1,3 +1,3 @@
1
1
  import './removable.js';
2
- export { bb as Action, p as Mutation, q as MutationState, bc as getDefaultState } from './types-Br-AgPmc.js';
2
+ export { bb as Action, p as Mutation, q as MutationState, bc as getDefaultState } from './types-B0i0SaOM.js';
3
3
  import './subscribable.js';
@@ -1,3 +1,3 @@
1
- export { M as MutationCache, d as MutationCacheNotifyEvent } from './types-Ya7vXgfL.cjs';
1
+ export { M as MutationCache, d as MutationCacheNotifyEvent } from './types-D3f-7LPM.cjs';
2
2
  import './subscribable.cjs';
3
3
  import './removable.cjs';
@@ -1,3 +1,3 @@
1
- export { M as MutationCache, d as MutationCacheNotifyEvent } from './types-Br-AgPmc.js';
1
+ export { M as MutationCache, d as MutationCacheNotifyEvent } from './types-B0i0SaOM.js';
2
2
  import './subscribable.js';
3
3
  import './removable.js';
@@ -1,3 +1,3 @@
1
1
  import './subscribable.cjs';
2
- export { e as MutationObserver } from './types-Ya7vXgfL.cjs';
2
+ export { e as MutationObserver } from './types-D3f-7LPM.cjs';
3
3
  import './removable.cjs';
@@ -1,3 +1,3 @@
1
1
  import './subscribable.js';
2
- export { e as MutationObserver } from './types-Br-AgPmc.js';
2
+ export { e as MutationObserver } from './types-B0i0SaOM.js';
3
3
  import './removable.js';
@@ -1,4 +1,4 @@
1
- import { ak as QueryObserverResult, b as QueryClient, W as QueryObserverOptions, aQ as NotifyOptions, o as Query, t as QueryKey, c as QueryObserver } from './types-Ya7vXgfL.cjs';
1
+ import { ak as QueryObserverResult, b as QueryClient, W as QueryObserverOptions, aQ as NotifyOptions, o as Query, t as QueryKey, c as QueryObserver } from './types-D3f-7LPM.cjs';
2
2
  import { Subscribable } from './subscribable.cjs';
3
3
  import './removable.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { ak as QueryObserverResult, b as QueryClient, W as QueryObserverOptions, aQ as NotifyOptions, o as Query, t as QueryKey, c as QueryObserver } from './types-Br-AgPmc.js';
1
+ import { ak as QueryObserverResult, b as QueryClient, W as QueryObserverOptions, aQ as NotifyOptions, o as Query, t as QueryKey, c as QueryObserver } from './types-B0i0SaOM.js';
2
2
  import { Subscribable } from './subscribable.js';
3
3
  import './removable.js';
4
4
 
@@ -1,3 +1,3 @@
1
1
  import './removable.cjs';
2
- export { aV as Action, aR as FetchContext, aS as FetchDirection, aT as FetchMeta, aU as FetchOptions, o as Query, aO as QueryBehavior, n as QueryState, aW as SetStateOptions, aX as fetchState } from './types-Ya7vXgfL.cjs';
2
+ export { aV as Action, aR as FetchContext, aS as FetchDirection, aT as FetchMeta, aU as FetchOptions, o as Query, aO as QueryBehavior, n as QueryState, aW as SetStateOptions, aX as fetchState } from './types-D3f-7LPM.cjs';
3
3
  import './subscribable.cjs';
@@ -1,3 +1,3 @@
1
1
  import './removable.js';
2
- export { aV as Action, aR as FetchContext, aS as FetchDirection, aT as FetchMeta, aU as FetchOptions, o as Query, aO as QueryBehavior, n as QueryState, aW as SetStateOptions, aX as fetchState } from './types-Br-AgPmc.js';
2
+ export { aV as Action, aR as FetchContext, aS as FetchDirection, aT as FetchMeta, aU as FetchOptions, o as Query, aO as QueryBehavior, n as QueryState, aW as SetStateOptions, aX as fetchState } from './types-B0i0SaOM.js';
3
3
  import './subscribable.js';
@@ -1,3 +1,3 @@
1
- export { Q as QueryCache, a as QueryCacheNotifyEvent, ba as QueryStore } from './types-Ya7vXgfL.cjs';
1
+ export { Q as QueryCache, a as QueryCacheNotifyEvent, ba as QueryStore } from './types-D3f-7LPM.cjs';
2
2
  import './subscribable.cjs';
3
3
  import './removable.cjs';
@@ -1,3 +1,3 @@
1
- export { Q as QueryCache, a as QueryCacheNotifyEvent, ba as QueryStore } from './types-Br-AgPmc.js';
1
+ export { Q as QueryCache, a as QueryCacheNotifyEvent, ba as QueryStore } from './types-B0i0SaOM.js';
2
2
  import './subscribable.js';
3
3
  import './removable.js';
@@ -1,3 +1,3 @@
1
- export { b as QueryClient } from './types-Ya7vXgfL.cjs';
1
+ export { b as QueryClient } from './types-D3f-7LPM.cjs';
2
2
  import './removable.cjs';
3
3
  import './subscribable.cjs';
@@ -1,3 +1,3 @@
1
- export { b as QueryClient } from './types-Br-AgPmc.js';
1
+ export { b as QueryClient } from './types-B0i0SaOM.js';
2
2
  import './removable.js';
3
3
  import './subscribable.js';
@@ -1,3 +1,3 @@
1
1
  import './subscribable.cjs';
2
- export { aQ as NotifyOptions, aP as ObserverFetchOptions, c as QueryObserver } from './types-Ya7vXgfL.cjs';
2
+ export { aQ as NotifyOptions, aP as ObserverFetchOptions, c as QueryObserver } from './types-D3f-7LPM.cjs';
3
3
  import './removable.cjs';
@@ -1,3 +1,3 @@
1
1
  import './subscribable.js';
2
- export { aQ as NotifyOptions, aP as ObserverFetchOptions, c as QueryObserver } from './types-Br-AgPmc.js';
2
+ export { aQ as NotifyOptions, aP as ObserverFetchOptions, c as QueryObserver } from './types-B0i0SaOM.js';
3
3
  import './removable.js';
@@ -1,3 +1,3 @@
1
- export { C as CancelledError, bf as RetryDelayValue, be as RetryValue, bd as Retryer, bg as canFetch, bh as createRetryer, l as isCancelledError } from './types-Ya7vXgfL.cjs';
1
+ export { C as CancelledError, bf as RetryDelayValue, be as RetryValue, bd as Retryer, bg as canFetch, bh as createRetryer, l as isCancelledError } from './types-D3f-7LPM.cjs';
2
2
  import './removable.cjs';
3
3
  import './subscribable.cjs';
@@ -1,3 +1,3 @@
1
- export { C as CancelledError, bf as RetryDelayValue, be as RetryValue, bd as Retryer, bg as canFetch, bh as createRetryer, l as isCancelledError } from './types-Br-AgPmc.js';
1
+ export { C as CancelledError, bf as RetryDelayValue, be as RetryValue, bd as Retryer, bg as canFetch, bh as createRetryer, l as isCancelledError } from './types-B0i0SaOM.js';
2
2
  import './removable.js';
3
3
  import './subscribable.js';
@@ -716,6 +716,13 @@ interface ResultOptions {
716
716
  throwOnError?: boolean;
717
717
  }
718
718
  interface RefetchOptions extends ResultOptions {
719
+ /**
720
+ * If set to `true`, a currently running request will be cancelled before a new request is made
721
+ *
722
+ * If set to `false`, no refetch will be made if there is already a request running.
723
+ *
724
+ * Defaults to `true`.
725
+ */
719
726
  cancelRefetch?: boolean;
720
727
  }
721
728
  interface InvalidateQueryFilters extends QueryFilters {
@@ -728,9 +735,25 @@ interface InvalidateOptions extends RefetchOptions {
728
735
  interface ResetOptions extends RefetchOptions {
729
736
  }
730
737
  interface FetchNextPageOptions extends ResultOptions {
738
+ /**
739
+ * If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time,
740
+ * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
741
+ *
742
+ * If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved.
743
+ *
744
+ * Defaults to `true`.
745
+ */
731
746
  cancelRefetch?: boolean;
732
747
  }
733
748
  interface FetchPreviousPageOptions extends ResultOptions {
749
+ /**
750
+ * If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time,
751
+ * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
752
+ *
753
+ * If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved.
754
+ *
755
+ * Defaults to `true`.
756
+ */
734
757
  cancelRefetch?: boolean;
735
758
  }
736
759
  type QueryStatus = 'pending' | 'error' | 'success';
@@ -911,11 +934,37 @@ interface QueryObserverSuccessResult<TData = unknown, TError = DefaultError> ext
911
934
  type DefinedQueryObserverResult<TData = unknown, TError = DefaultError> = QueryObserverRefetchErrorResult<TData, TError> | QueryObserverSuccessResult<TData, TError>;
912
935
  type QueryObserverResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError> | QueryObserverLoadingErrorResult<TData, TError> | QueryObserverLoadingResult<TData, TError> | QueryObserverPendingResult<TData, TError>;
913
936
  interface InfiniteQueryObserverBaseResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
937
+ /**
938
+ * This function allows you to fetch the next "page" of results.
939
+ */
914
940
  fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<TData, TError>>;
941
+ /**
942
+ * This function allows you to fetch the previous "page" of results.
943
+ */
915
944
  fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise<InfiniteQueryObserverResult<TData, TError>>;
945
+ /**
946
+ * Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
947
+ */
916
948
  hasNextPage: boolean;
949
+ /**
950
+ * Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
951
+ */
917
952
  hasPreviousPage: boolean;
953
+ /**
954
+ * Will be `true` if the query failed while fetching the next page.
955
+ */
956
+ isFetchNextPageError: boolean;
957
+ /**
958
+ * Will be `true` while fetching the next page with `fetchNextPage`.
959
+ */
918
960
  isFetchingNextPage: boolean;
961
+ /**
962
+ * Will be `true` if the query failed while fetching the previous page.
963
+ */
964
+ isFetchPreviousPageError: boolean;
965
+ /**
966
+ * Will be `true` while fetching the previous page with `fetchPreviousPage`.
967
+ */
919
968
  isFetchingPreviousPage: boolean;
920
969
  }
921
970
  interface InfiniteQueryObserverPendingResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
@@ -925,6 +974,8 @@ interface InfiniteQueryObserverPendingResult<TData = unknown, TError = DefaultEr
925
974
  isPending: true;
926
975
  isLoadingError: false;
927
976
  isRefetchError: false;
977
+ isFetchNextPageError: false;
978
+ isFetchPreviousPageError: false;
928
979
  isSuccess: false;
929
980
  status: 'pending';
930
981
  }
@@ -936,6 +987,8 @@ interface InfiniteQueryObserverLoadingResult<TData = unknown, TError = DefaultEr
936
987
  isLoading: true;
937
988
  isLoadingError: false;
938
989
  isRefetchError: false;
990
+ isFetchNextPageError: false;
991
+ isFetchPreviousPageError: false;
939
992
  isSuccess: false;
940
993
  status: 'pending';
941
994
  }
@@ -947,6 +1000,8 @@ interface InfiniteQueryObserverLoadingErrorResult<TData = unknown, TError = Defa
947
1000
  isLoading: false;
948
1001
  isLoadingError: true;
949
1002
  isRefetchError: false;
1003
+ isFetchNextPageError: false;
1004
+ isFetchPreviousPageError: false;
950
1005
  isSuccess: false;
951
1006
  status: 'error';
952
1007
  }
@@ -958,6 +1013,8 @@ interface InfiniteQueryObserverRefetchErrorResult<TData = unknown, TError = Defa
958
1013
  isLoading: false;
959
1014
  isLoadingError: false;
960
1015
  isRefetchError: true;
1016
+ isFetchNextPageError: false;
1017
+ isFetchPreviousPageError: false;
961
1018
  isSuccess: false;
962
1019
  status: 'error';
963
1020
  }
@@ -969,6 +1026,8 @@ interface InfiniteQueryObserverSuccessResult<TData = unknown, TError = DefaultEr
969
1026
  isLoading: false;
970
1027
  isLoadingError: false;
971
1028
  isRefetchError: false;
1029
+ isFetchNextPageError: false;
1030
+ isFetchPreviousPageError: false;
972
1031
  isSuccess: true;
973
1032
  status: 'success';
974
1033
  }
@@ -716,6 +716,13 @@ interface ResultOptions {
716
716
  throwOnError?: boolean;
717
717
  }
718
718
  interface RefetchOptions extends ResultOptions {
719
+ /**
720
+ * If set to `true`, a currently running request will be cancelled before a new request is made
721
+ *
722
+ * If set to `false`, no refetch will be made if there is already a request running.
723
+ *
724
+ * Defaults to `true`.
725
+ */
719
726
  cancelRefetch?: boolean;
720
727
  }
721
728
  interface InvalidateQueryFilters extends QueryFilters {
@@ -728,9 +735,25 @@ interface InvalidateOptions extends RefetchOptions {
728
735
  interface ResetOptions extends RefetchOptions {
729
736
  }
730
737
  interface FetchNextPageOptions extends ResultOptions {
738
+ /**
739
+ * If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time,
740
+ * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
741
+ *
742
+ * If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved.
743
+ *
744
+ * Defaults to `true`.
745
+ */
731
746
  cancelRefetch?: boolean;
732
747
  }
733
748
  interface FetchPreviousPageOptions extends ResultOptions {
749
+ /**
750
+ * If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time,
751
+ * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
752
+ *
753
+ * If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved.
754
+ *
755
+ * Defaults to `true`.
756
+ */
734
757
  cancelRefetch?: boolean;
735
758
  }
736
759
  type QueryStatus = 'pending' | 'error' | 'success';
@@ -911,11 +934,37 @@ interface QueryObserverSuccessResult<TData = unknown, TError = DefaultError> ext
911
934
  type DefinedQueryObserverResult<TData = unknown, TError = DefaultError> = QueryObserverRefetchErrorResult<TData, TError> | QueryObserverSuccessResult<TData, TError>;
912
935
  type QueryObserverResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError> | QueryObserverLoadingErrorResult<TData, TError> | QueryObserverLoadingResult<TData, TError> | QueryObserverPendingResult<TData, TError>;
913
936
  interface InfiniteQueryObserverBaseResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
937
+ /**
938
+ * This function allows you to fetch the next "page" of results.
939
+ */
914
940
  fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<TData, TError>>;
941
+ /**
942
+ * This function allows you to fetch the previous "page" of results.
943
+ */
915
944
  fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise<InfiniteQueryObserverResult<TData, TError>>;
945
+ /**
946
+ * Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
947
+ */
916
948
  hasNextPage: boolean;
949
+ /**
950
+ * Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
951
+ */
917
952
  hasPreviousPage: boolean;
953
+ /**
954
+ * Will be `true` if the query failed while fetching the next page.
955
+ */
956
+ isFetchNextPageError: boolean;
957
+ /**
958
+ * Will be `true` while fetching the next page with `fetchNextPage`.
959
+ */
918
960
  isFetchingNextPage: boolean;
961
+ /**
962
+ * Will be `true` if the query failed while fetching the previous page.
963
+ */
964
+ isFetchPreviousPageError: boolean;
965
+ /**
966
+ * Will be `true` while fetching the previous page with `fetchPreviousPage`.
967
+ */
919
968
  isFetchingPreviousPage: boolean;
920
969
  }
921
970
  interface InfiniteQueryObserverPendingResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
@@ -925,6 +974,8 @@ interface InfiniteQueryObserverPendingResult<TData = unknown, TError = DefaultEr
925
974
  isPending: true;
926
975
  isLoadingError: false;
927
976
  isRefetchError: false;
977
+ isFetchNextPageError: false;
978
+ isFetchPreviousPageError: false;
928
979
  isSuccess: false;
929
980
  status: 'pending';
930
981
  }
@@ -936,6 +987,8 @@ interface InfiniteQueryObserverLoadingResult<TData = unknown, TError = DefaultEr
936
987
  isLoading: true;
937
988
  isLoadingError: false;
938
989
  isRefetchError: false;
990
+ isFetchNextPageError: false;
991
+ isFetchPreviousPageError: false;
939
992
  isSuccess: false;
940
993
  status: 'pending';
941
994
  }
@@ -947,6 +1000,8 @@ interface InfiniteQueryObserverLoadingErrorResult<TData = unknown, TError = Defa
947
1000
  isLoading: false;
948
1001
  isLoadingError: true;
949
1002
  isRefetchError: false;
1003
+ isFetchNextPageError: false;
1004
+ isFetchPreviousPageError: false;
950
1005
  isSuccess: false;
951
1006
  status: 'error';
952
1007
  }
@@ -958,6 +1013,8 @@ interface InfiniteQueryObserverRefetchErrorResult<TData = unknown, TError = Defa
958
1013
  isLoading: false;
959
1014
  isLoadingError: false;
960
1015
  isRefetchError: true;
1016
+ isFetchNextPageError: false;
1017
+ isFetchPreviousPageError: false;
961
1018
  isSuccess: false;
962
1019
  status: 'error';
963
1020
  }
@@ -969,6 +1026,8 @@ interface InfiniteQueryObserverSuccessResult<TData = unknown, TError = DefaultEr
969
1026
  isLoading: false;
970
1027
  isLoadingError: false;
971
1028
  isRefetchError: false;
1029
+ isFetchNextPageError: false;
1030
+ isFetchPreviousPageError: false;
972
1031
  isSuccess: true;
973
1032
  status: 'success';
974
1033
  }