@tanstack/query-core 5.0.0-alpha.21 → 5.0.0-alpha.23

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": "5.0.0-alpha.21",
3
+ "version": "5.0.0-alpha.23",
4
4
  "description": "The framework agnostic core that powers TanStack Query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -478,8 +478,8 @@ export class QueryClient {
478
478
  defaultedOptions.refetchOnReconnect =
479
479
  defaultedOptions.networkMode !== 'always'
480
480
  }
481
- if (typeof defaultedOptions.throwErrors === 'undefined') {
482
- defaultedOptions.throwErrors = !!defaultedOptions.suspense
481
+ if (typeof defaultedOptions.throwOnError === 'undefined') {
482
+ defaultedOptions.throwOnError = !!defaultedOptions.suspense
483
483
  }
484
484
 
485
485
  return defaultedOptions as DefaultedQueryObserverOptions<
@@ -342,12 +342,14 @@ export class QueryObserver<
342
342
  }
343
343
 
344
344
  #computeRefetchInterval() {
345
- return typeof this.options.refetchInterval === 'function'
346
- ? this.options.refetchInterval(
347
- this.#currentResult.data,
348
- this.#currentQuery,
349
- )
350
- : this.options.refetchInterval ?? false
345
+ return (
346
+ (typeof this.options.refetchInterval === 'function'
347
+ ? this.options.refetchInterval(
348
+ this.#currentResult.data,
349
+ this.#currentQuery,
350
+ )
351
+ : this.options.refetchInterval) ?? false
352
+ )
351
353
  }
352
354
 
353
355
  #updateRefetchInterval(nextInterval: number | false): void {
@@ -593,7 +595,7 @@ export class QueryObserver<
593
595
 
594
596
  const includedProps = new Set(notifyOnChangeProps ?? this.#trackedProps)
595
597
 
596
- if (this.options.throwErrors) {
598
+ if (this.options.throwOnError) {
597
599
  includedProps.add('error')
598
600
  }
599
601
 
package/src/types.ts CHANGED
@@ -154,7 +154,7 @@ export interface InfiniteQueryPageParamsOptions<
154
154
  getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>
155
155
  }
156
156
 
157
- export type ThrowErrors<
157
+ export type ThrowOnError<
158
158
  TQueryFnData,
159
159
  TError,
160
160
  TQueryData,
@@ -202,7 +202,7 @@ export interface QueryObserverOptions<
202
202
  | ((
203
203
  data: TData | undefined,
204
204
  query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,
205
- ) => number | false)
205
+ ) => number | false | undefined)
206
206
  /**
207
207
  * If set to `true`, the query will continue to refetch while their tab/window is in the background.
208
208
  * Defaults to `false`.
@@ -266,7 +266,7 @@ export interface QueryObserverOptions<
266
266
  * 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`).
267
267
  * Defaults to `false`.
268
268
  */
269
- throwErrors?: ThrowErrors<TQueryFnData, TError, TQueryData, TQueryKey>
269
+ throwOnError?: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>
270
270
  /**
271
271
  * This option can be used to transform or select a part of the data returned by the query function.
272
272
  */
@@ -297,7 +297,7 @@ export type DefaultedQueryObserverOptions<
297
297
  TQueryKey extends QueryKey = QueryKey,
298
298
  > = WithRequired<
299
299
  QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>,
300
- 'throwErrors' | 'refetchOnReconnect'
300
+ 'throwOnError' | 'refetchOnReconnect'
301
301
  >
302
302
 
303
303
  export interface InfiniteQueryObserverOptions<
@@ -333,7 +333,7 @@ export type DefaultedInfiniteQueryObserverOptions<
333
333
  TQueryKey,
334
334
  TPageParam
335
335
  >,
336
- 'throwErrors' | 'refetchOnReconnect'
336
+ 'throwOnError' | 'refetchOnReconnect'
337
337
  >
338
338
 
339
339
  export interface FetchQueryOptions<
@@ -636,7 +636,7 @@ export interface MutationObserverOptions<
636
636
  TVariables = void,
637
637
  TContext = unknown,
638
638
  > extends MutationOptions<TData, TError, TVariables, TContext> {
639
- throwErrors?: boolean | ((error: TError) => boolean)
639
+ throwOnError?: boolean | ((error: TError) => boolean)
640
640
  }
641
641
 
642
642
  export interface MutateOptions<