@tanstack/query-core 4.5.0 → 4.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-core",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "TODO",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -113,6 +113,10 @@ export class QueriesObserver extends Subscribable<QueriesObserverListener> {
113
113
  return this.result
114
114
  }
115
115
 
116
+ getQueries() {
117
+ return this.observers.map((observer) => observer.getCurrentQuery())
118
+ }
119
+
116
120
  getOptimisticResult(queries: QueryObserverOptions[]): QueryObserverResult[] {
117
121
  return this.findMatchingObservers(queries).map((match) =>
118
122
  match.observer.getOptimisticResult(match.defaultedQueryOptions),
package/src/types.ts CHANGED
@@ -100,6 +100,18 @@ export interface QueryOptions<
100
100
  meta?: QueryMeta
101
101
  }
102
102
 
103
+ export type UseErrorBoundary<
104
+ TQueryFnData,
105
+ TError,
106
+ TQueryData,
107
+ TQueryKey extends QueryKey,
108
+ > =
109
+ | boolean
110
+ | ((
111
+ error: TError,
112
+ query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,
113
+ ) => boolean)
114
+
103
115
  export interface QueryObserverOptions<
104
116
  TQueryFnData = unknown,
105
117
  TError = unknown,
@@ -205,12 +217,12 @@ export interface QueryObserverOptions<
205
217
  * If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`).
206
218
  * Defaults to `false`.
207
219
  */
208
- useErrorBoundary?:
209
- | boolean
210
- | ((
211
- error: TError,
212
- query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,
213
- ) => boolean)
220
+ useErrorBoundary?: UseErrorBoundary<
221
+ TQueryFnData,
222
+ TError,
223
+ TQueryData,
224
+ TQueryKey
225
+ >
214
226
  /**
215
227
  * This option can be used to transform or select a part of the data returned by the query function.
216
228
  */