@tanstack/react-query
Advanced tools
Comparing version 5.51.21 to 5.51.23
@@ -7,3 +7,3 @@ import { QueryKey, Query, DefaultedQueryObserverOptions, QueryObserverResult, QueryObserver } from '@tanstack/query-core'; | ||
declare const defaultThrowOnError: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean; | ||
declare const ensureStaleTime: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean; | ||
@@ -13,2 +13,2 @@ declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined; | ||
export { defaultThrowOnError, ensureStaleTime, fetchOptimistic, shouldSuspend, willFetch }; | ||
export { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend, willFetch }; |
// src/suspense.ts | ||
var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
var ensureStaleTime = (defaultedOptions) => { | ||
var ensureSuspenseTimers = (defaultedOptions) => { | ||
if (defaultedOptions.suspense) { | ||
@@ -8,2 +8,5 @@ if (typeof defaultedOptions.staleTime !== "number") { | ||
} | ||
if (typeof defaultedOptions.gcTime === "number") { | ||
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3); | ||
} | ||
} | ||
@@ -18,3 +21,3 @@ }; | ||
defaultThrowOnError, | ||
ensureStaleTime, | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
@@ -21,0 +24,0 @@ shouldSuspend, |
@@ -14,3 +14,7 @@ "use client"; | ||
} from "./errorBoundaryUtils.js"; | ||
import { ensureStaleTime, fetchOptimistic, shouldSuspend } from "./suspense.js"; | ||
import { | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
shouldSuspend | ||
} from "./suspense.js"; | ||
function useBaseQuery(options, Observer, queryClient) { | ||
@@ -34,3 +38,3 @@ var _a, _b, _c, _d; | ||
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
ensureStaleTime(defaultedOptions); | ||
ensureSuspenseTimers(defaultedOptions); | ||
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary); | ||
@@ -37,0 +41,0 @@ useClearResetErrorBoundary(errorResetBoundary); |
@@ -19,3 +19,3 @@ "use client"; | ||
import { | ||
ensureStaleTime, | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
@@ -43,3 +43,3 @@ shouldSuspend, | ||
defaultedQueries.forEach((query) => { | ||
ensureStaleTime(query); | ||
ensureSuspenseTimers(query); | ||
ensurePreventErrorBoundaryRetry(query, errorResetBoundary); | ||
@@ -46,0 +46,0 @@ }); |
@@ -7,3 +7,3 @@ import { QueryKey, Query, DefaultedQueryObserverOptions, QueryObserverResult, QueryObserver } from '@tanstack/query-core'; | ||
declare const defaultThrowOnError: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean; | ||
declare const ensureStaleTime: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean; | ||
@@ -13,2 +13,2 @@ declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined; | ||
export { defaultThrowOnError, ensureStaleTime, fetchOptimistic, shouldSuspend, willFetch }; | ||
export { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend, willFetch }; |
// src/suspense.ts | ||
var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
var ensureStaleTime = (defaultedOptions) => { | ||
var ensureSuspenseTimers = (defaultedOptions) => { | ||
if (defaultedOptions.suspense) { | ||
@@ -8,2 +8,5 @@ if (typeof defaultedOptions.staleTime !== "number") { | ||
} | ||
if (typeof defaultedOptions.gcTime === "number") { | ||
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3); | ||
} | ||
} | ||
@@ -18,3 +21,3 @@ }; | ||
defaultThrowOnError, | ||
ensureStaleTime, | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
@@ -21,0 +24,0 @@ shouldSuspend, |
@@ -14,3 +14,7 @@ "use client"; | ||
} from "./errorBoundaryUtils.js"; | ||
import { ensureStaleTime, fetchOptimistic, shouldSuspend } from "./suspense.js"; | ||
import { | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
shouldSuspend | ||
} from "./suspense.js"; | ||
function useBaseQuery(options, Observer, queryClient) { | ||
@@ -32,3 +36,3 @@ if (process.env.NODE_ENV !== "production") { | ||
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
ensureStaleTime(defaultedOptions); | ||
ensureSuspenseTimers(defaultedOptions); | ||
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary); | ||
@@ -35,0 +39,0 @@ useClearResetErrorBoundary(errorResetBoundary); |
@@ -19,3 +19,3 @@ "use client"; | ||
import { | ||
ensureStaleTime, | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
@@ -43,3 +43,3 @@ shouldSuspend, | ||
defaultedQueries.forEach((query) => { | ||
ensureStaleTime(query); | ||
ensureSuspenseTimers(query); | ||
ensurePreventErrorBoundaryRetry(query, errorResetBoundary); | ||
@@ -46,0 +46,0 @@ }); |
{ | ||
"name": "@tanstack/react-query", | ||
"version": "5.51.21", | ||
"version": "5.51.23", | ||
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -21,3 +21,3 @@ import type { | ||
export const ensureStaleTime = ( | ||
export const ensureSuspenseTimers = ( | ||
defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>, | ||
@@ -31,2 +31,5 @@ ) => { | ||
} | ||
if (typeof defaultedOptions.gcTime === 'number') { | ||
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1000) | ||
} | ||
} | ||
@@ -33,0 +36,0 @@ } |
@@ -13,3 +13,7 @@ 'use client' | ||
} from './errorBoundaryUtils' | ||
import { ensureStaleTime, fetchOptimistic, shouldSuspend } from './suspense' | ||
import { | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
shouldSuspend, | ||
} from './suspense' | ||
import type { UseBaseQueryOptions } from './types' | ||
@@ -62,3 +66,3 @@ import type { | ||
ensureStaleTime(defaultedOptions) | ||
ensureSuspenseTimers(defaultedOptions) | ||
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary) | ||
@@ -65,0 +69,0 @@ |
@@ -18,3 +18,3 @@ 'use client' | ||
import { | ||
ensureStaleTime, | ||
ensureSuspenseTimers, | ||
fetchOptimistic, | ||
@@ -259,3 +259,3 @@ shouldSuspend, | ||
defaultedQueries.forEach((query) => { | ||
ensureStaleTime(query) | ||
ensureSuspenseTimers(query) | ||
ensurePreventErrorBoundaryRetry(query, errorResetBoundary) | ||
@@ -262,0 +262,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1104996
22041