@tanstack/query-core
Advanced tools
Comparing version
@@ -1,3 +0,3 @@ | ||
export { D as DehydrateOptions, z as DehydratedState, H as HydrateOptions, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, q as hydrate } from './hydration-17eepgNg.js'; | ||
export { D as DehydrateOptions, z as DehydratedState, H as HydrateOptions, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, q as hydrate } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,2 +0,2 @@ | ||
export { P as AnyDataTag, b4 as CancelOptions, C as CancelledError, T as DataTag, F as DefaultError, b3 as DefaultOptions, ai as DefaultedInfiniteQueryObserverOptions, ag as DefaultedQueryObserverOptions, aN as DefinedInfiniteQueryObserverResult, aE as DefinedQueryObserverResult, D as DehydrateOptions, z as DehydratedState, A as DistributiveOmit, Z as Enabled, al as EnsureInfiniteQueryDataOptions, ak as EnsureQueryDataOptions, am as FetchInfiniteQueryOptions, at as FetchNextPageOptions, au as FetchPreviousPageOptions, aj as FetchQueryOptions, aw as FetchStatus, a5 as GetNextPageParamFunction, a4 as GetPreviousPageParamFunction, H as HydrateOptions, V as InferDataFromTag, W as InferErrorFromTag, a6 as InfiniteData, aG as InfiniteQueryObserverBaseResult, aJ as InfiniteQueryObserverLoadingErrorResult, aI as InfiniteQueryObserverLoadingResult, ah as InfiniteQueryObserverOptions, aH as InfiniteQueryObserverPendingResult, aM as InfiniteQueryObserverPlaceholderResult, aK as InfiniteQueryObserverRefetchErrorResult, aO as InfiniteQueryObserverResult, aL as InfiniteQueryObserverSuccessResult, ac as InfiniteQueryPageParamsOptions, a0 as InitialDataFunction, ab as InitialPageParam, ar as InvalidateOptions, ap as InvalidateQueryFilters, aX as MutateFunction, aW as MutateOptions, y as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, j as MutationFilters, aT as MutationFunction, aP as MutationKey, aS as MutationMeta, e as MutationObserver, aY as MutationObserverBaseResult, a$ as MutationObserverErrorResult, aZ as MutationObserverIdleResult, a_ as MutationObserverLoadingResult, aV as MutationObserverOptions, b1 as MutationObserverResult, b0 as MutationObserverSuccessResult, aU as MutationOptions, aR as MutationScope, x as MutationState, aQ as MutationStatus, a8 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b7 as NotifyEvent, b6 as NotifyEventType, a9 as NotifyOnChangeProps, O as OmitKeyof, B as Override, a1 as PlaceholderDataFunction, a2 as QueriesPlaceholderDataFunction, w as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, b2 as QueryClientConfig, l as QueryFilters, X as QueryFunction, $ as QueryFunctionContext, G as QueryKey, a3 as QueryKeyHashFunction, a7 as QueryMeta, c as QueryObserver, ax as QueryObserverBaseResult, aA as QueryObserverLoadingErrorResult, az as QueryObserverLoadingResult, ae as QueryObserverOptions, ay as QueryObserverPendingResult, aD as QueryObserverPlaceholderResult, aB as QueryObserverRefetchErrorResult, aF as QueryObserverResult, aC as QueryObserverSuccessResult, aa as QueryOptions, _ as QueryPersister, v as QueryState, av as QueryStatus, ao as RefetchOptions, aq as RefetchQueryFilters, R as Register, as as ResetOptions, an as ResultOptions, b5 as SetDataOptions, S as SkipToken, Y as StaleTime, ad as ThrowOnError, L as UnsetMarker, U as Updater, af as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, h as hashKey, q as hydrate, o as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, r as replaceEqualDeep, g as shouldThrowError, s as skipToken, K as unsetMarker } from './hydration-17eepgNg.js'; | ||
export { P as AnyDataTag, b5 as CancelOptions, C as CancelledError, T as DataTag, F as DefaultError, b4 as DefaultOptions, aj as DefaultedInfiniteQueryObserverOptions, ah as DefaultedQueryObserverOptions, aO as DefinedInfiniteQueryObserverResult, aF as DefinedQueryObserverResult, D as DehydrateOptions, z as DehydratedState, A as DistributiveOmit, _ as Enabled, am as EnsureInfiniteQueryDataOptions, al as EnsureQueryDataOptions, an as FetchInfiniteQueryOptions, au as FetchNextPageOptions, av as FetchPreviousPageOptions, ak as FetchQueryOptions, ax as FetchStatus, a6 as GetNextPageParamFunction, a5 as GetPreviousPageParamFunction, H as HydrateOptions, V as InferDataFromTag, W as InferErrorFromTag, a7 as InfiniteData, aH as InfiniteQueryObserverBaseResult, aK as InfiniteQueryObserverLoadingErrorResult, aJ as InfiniteQueryObserverLoadingResult, ai as InfiniteQueryObserverOptions, aI as InfiniteQueryObserverPendingResult, aN as InfiniteQueryObserverPlaceholderResult, aL as InfiniteQueryObserverRefetchErrorResult, aP as InfiniteQueryObserverResult, aM as InfiniteQueryObserverSuccessResult, ad as InfiniteQueryPageParamsOptions, a1 as InitialDataFunction, ac as InitialPageParam, as as InvalidateOptions, aq as InvalidateQueryFilters, aY as MutateFunction, aX as MutateOptions, y as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, j as MutationFilters, aU as MutationFunction, aQ as MutationKey, aT as MutationMeta, e as MutationObserver, aZ as MutationObserverBaseResult, b0 as MutationObserverErrorResult, a_ as MutationObserverIdleResult, a$ as MutationObserverLoadingResult, aW as MutationObserverOptions, b2 as MutationObserverResult, b1 as MutationObserverSuccessResult, aV as MutationOptions, aS as MutationScope, x as MutationState, aR as MutationStatus, a9 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b8 as NotifyEvent, b7 as NotifyEventType, aa as NotifyOnChangeProps, O as OmitKeyof, B as Override, a2 as PlaceholderDataFunction, a3 as QueriesPlaceholderDataFunction, w as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, b3 as QueryClientConfig, l as QueryFilters, X as QueryFunction, a0 as QueryFunctionContext, G as QueryKey, a4 as QueryKeyHashFunction, a8 as QueryMeta, c as QueryObserver, ay as QueryObserverBaseResult, aB as QueryObserverLoadingErrorResult, aA as QueryObserverLoadingResult, af as QueryObserverOptions, az as QueryObserverPendingResult, aE as QueryObserverPlaceholderResult, aC as QueryObserverRefetchErrorResult, aG as QueryObserverResult, aD as QueryObserverSuccessResult, ab as QueryOptions, $ as QueryPersister, v as QueryState, aw as QueryStatus, ap as RefetchOptions, ar as RefetchQueryFilters, R as Register, at as ResetOptions, ao as ResultOptions, b6 as SetDataOptions, S as SkipToken, Y as StaleTime, Z as StaleTimeFunction, ae as ThrowOnError, L as UnsetMarker, U as Updater, ag as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, h as hashKey, q as hydrate, o as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, r as replaceEqualDeep, g as shouldThrowError, s as skipToken, K as unsetMarker } from './hydration-BCnR_RAv.js'; | ||
export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.js'; | ||
@@ -3,0 +3,0 @@ export { InfiniteQueryObserver } from './infiniteQueryObserver.js'; |
@@ -1,2 +0,2 @@ | ||
import { b8 as QueryBehavior, a6 as InfiniteData, ac as InfiniteQueryPageParamsOptions } from './hydration-17eepgNg.js'; | ||
import { b9 as QueryBehavior, a7 as InfiniteData, ad as InfiniteQueryPageParamsOptions } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
@@ -3,0 +3,0 @@ import './subscribable.js'; |
@@ -1,2 +0,2 @@ | ||
import { F as DefaultError, a6 as InfiniteData, G as QueryKey, c as QueryObserver, aO as InfiniteQueryObserverResult, b as QueryClient, ah as InfiniteQueryObserverOptions, ai as DefaultedInfiniteQueryObserverOptions, at as FetchNextPageOptions, au as FetchPreviousPageOptions, w as Query } from './hydration-17eepgNg.js'; | ||
import { F as DefaultError, a7 as InfiniteData, G as QueryKey, c as QueryObserver, aP as InfiniteQueryObserverResult, b as QueryClient, ai as InfiniteQueryObserverOptions, aj as DefaultedInfiniteQueryObserverOptions, au as FetchNextPageOptions, av as FetchPreviousPageOptions, w as Query } from './hydration-BCnR_RAv.js'; | ||
import { Subscribable } from './subscribable.js'; | ||
@@ -3,0 +3,0 @@ import './removable.js'; |
import './removable.js'; | ||
export { bg as Action, y as Mutation, x as MutationState, bh as getDefaultState } from './hydration-17eepgNg.js'; | ||
export { bh as Action, y as Mutation, x as MutationState, bi as getDefaultState } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { M as MutationCache, d as MutationCacheNotifyEvent } from './hydration-17eepgNg.js'; | ||
export { M as MutationCache, d as MutationCacheNotifyEvent } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; | ||
import './removable.js'; |
import './subscribable.js'; | ||
export { e as MutationObserver } from './hydration-17eepgNg.js'; | ||
export { e as MutationObserver } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; |
@@ -1,2 +0,2 @@ | ||
import { aF as QueryObserverResult, b as QueryClient, ae as QueryObserverOptions, w as Query, c as QueryObserver } from './hydration-17eepgNg.js'; | ||
import { aG as QueryObserverResult, b as QueryClient, af as QueryObserverOptions, w as Query, c as QueryObserver } from './hydration-BCnR_RAv.js'; | ||
import { Subscribable } from './subscribable.js'; | ||
@@ -3,0 +3,0 @@ import './removable.js'; |
import './removable.js'; | ||
export { bd as Action, b9 as FetchContext, ba as FetchDirection, bb as FetchMeta, bc as FetchOptions, w as Query, b8 as QueryBehavior, v as QueryState, be as SetStateOptions, bf as fetchState } from './hydration-17eepgNg.js'; | ||
export { be as Action, ba as FetchContext, bb as FetchDirection, bc as FetchMeta, bd as FetchOptions, w as Query, b9 as QueryBehavior, v as QueryState, bf as SetStateOptions, bg as fetchState } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; |
@@ -14,2 +14,3 @@ import { | ||
resolveEnabled, | ||
resolveStaleTime, | ||
skipToken, | ||
@@ -99,6 +100,11 @@ timeUntilStale | ||
} | ||
isStatic() { | ||
if (this.getObserversCount() > 0) { | ||
return this.observers.some( | ||
(observer) => resolveStaleTime(observer.options.staleTime, this) === "static" | ||
); | ||
} | ||
return false; | ||
} | ||
isStale() { | ||
if (this.state.isInvalidated) { | ||
return true; | ||
} | ||
if (this.getObserversCount() > 0) { | ||
@@ -109,6 +115,15 @@ return this.observers.some( | ||
} | ||
return this.state.data === void 0; | ||
return this.state.data === void 0 || this.state.isInvalidated; | ||
} | ||
isStaleByTime(staleTime = 0) { | ||
return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime); | ||
if (this.state.data === void 0) { | ||
return true; | ||
} | ||
if (staleTime === "static") { | ||
return false; | ||
} | ||
if (this.state.isInvalidated) { | ||
return true; | ||
} | ||
return !timeUntilStale(this.state.dataUpdatedAt, staleTime); | ||
} | ||
@@ -115,0 +130,0 @@ onFocus() { |
@@ -1,3 +0,3 @@ | ||
export { Q as QueryCache, a as QueryCacheNotifyEvent, by as QueryStore } from './hydration-17eepgNg.js'; | ||
export { Q as QueryCache, a as QueryCacheNotifyEvent, bz as QueryStore } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; | ||
import './removable.js'; |
@@ -1,3 +0,3 @@ | ||
export { b as QueryClient } from './hydration-17eepgNg.js'; | ||
export { b as QueryClient } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -183,3 +183,3 @@ import { | ||
const promises = notifyManager.batch( | ||
() => __privateGet(this, _queryCache).findAll(filters).filter((query) => !query.isDisabled()).map((query) => { | ||
() => __privateGet(this, _queryCache).findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => { | ||
let promise = query.fetch(void 0, fetchOptions); | ||
@@ -186,0 +186,0 @@ if (!fetchOptions.throwOnError) { |
import './subscribable.js'; | ||
export { c as QueryObserver } from './hydration-17eepgNg.js'; | ||
export { c as QueryObserver } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; |
@@ -468,3 +468,3 @@ import { | ||
function shouldFetchOn(query, options, field) { | ||
if (resolveEnabled(options.enabled, query) !== false) { | ||
if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") { | ||
const value = typeof field === "function" ? field(query) : field; | ||
@@ -471,0 +471,0 @@ return value === "always" || value !== false && isStale(query, options); |
@@ -1,3 +0,3 @@ | ||
export { C as CancelledError, bB as RetryDelayValue, bA as RetryValue, bz as Retryer, bC as canFetch, bD as createRetryer, o as isCancelledError } from './hydration-17eepgNg.js'; | ||
export { C as CancelledError, bC as RetryDelayValue, bB as RetryValue, bA as Retryer, bD as canFetch, bE as createRetryer, o as isCancelledError } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,2 +0,2 @@ | ||
import { G as QueryKey, $ as QueryFunctionContext, X as QueryFunction } from './hydration-17eepgNg.js'; | ||
import { G as QueryKey, a0 as QueryFunctionContext, X as QueryFunction } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
@@ -3,0 +3,0 @@ import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { P as AnyDataTag, b4 as CancelOptions, T as DataTag, F as DefaultError, b3 as DefaultOptions, ai as DefaultedInfiniteQueryObserverOptions, ag as DefaultedQueryObserverOptions, aN as DefinedInfiniteQueryObserverResult, aE as DefinedQueryObserverResult, A as DistributiveOmit, Z as Enabled, al as EnsureInfiniteQueryDataOptions, ak as EnsureQueryDataOptions, am as FetchInfiniteQueryOptions, at as FetchNextPageOptions, au as FetchPreviousPageOptions, aj as FetchQueryOptions, aw as FetchStatus, a5 as GetNextPageParamFunction, a4 as GetPreviousPageParamFunction, V as InferDataFromTag, W as InferErrorFromTag, a6 as InfiniteData, aG as InfiniteQueryObserverBaseResult, aJ as InfiniteQueryObserverLoadingErrorResult, aI as InfiniteQueryObserverLoadingResult, ah as InfiniteQueryObserverOptions, aH as InfiniteQueryObserverPendingResult, aM as InfiniteQueryObserverPlaceholderResult, aK as InfiniteQueryObserverRefetchErrorResult, aO as InfiniteQueryObserverResult, aL as InfiniteQueryObserverSuccessResult, ac as InfiniteQueryPageParamsOptions, a0 as InitialDataFunction, ab as InitialPageParam, ar as InvalidateOptions, ap as InvalidateQueryFilters, aX as MutateFunction, aW as MutateOptions, aT as MutationFunction, aP as MutationKey, aS as MutationMeta, aY as MutationObserverBaseResult, a$ as MutationObserverErrorResult, aZ as MutationObserverIdleResult, a_ as MutationObserverLoadingResult, aV as MutationObserverOptions, b1 as MutationObserverResult, b0 as MutationObserverSuccessResult, aU as MutationOptions, aR as MutationScope, aQ as MutationStatus, a8 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b7 as NotifyEvent, b6 as NotifyEventType, a9 as NotifyOnChangeProps, O as OmitKeyof, B as Override, a1 as PlaceholderDataFunction, a2 as QueriesPlaceholderDataFunction, b2 as QueryClientConfig, X as QueryFunction, $ as QueryFunctionContext, G as QueryKey, a3 as QueryKeyHashFunction, a7 as QueryMeta, ax as QueryObserverBaseResult, aA as QueryObserverLoadingErrorResult, az as QueryObserverLoadingResult, ae as QueryObserverOptions, ay as QueryObserverPendingResult, aD as QueryObserverPlaceholderResult, aB as QueryObserverRefetchErrorResult, aF as QueryObserverResult, aC as QueryObserverSuccessResult, aa as QueryOptions, _ as QueryPersister, av as QueryStatus, ao as RefetchOptions, aq as RefetchQueryFilters, R as Register, as as ResetOptions, an as ResultOptions, b5 as SetDataOptions, Y as StaleTime, ad as ThrowOnError, L as UnsetMarker, af as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, K as unsetMarker } from './hydration-17eepgNg.js'; | ||
export { P as AnyDataTag, b5 as CancelOptions, T as DataTag, F as DefaultError, b4 as DefaultOptions, aj as DefaultedInfiniteQueryObserverOptions, ah as DefaultedQueryObserverOptions, aO as DefinedInfiniteQueryObserverResult, aF as DefinedQueryObserverResult, A as DistributiveOmit, _ as Enabled, am as EnsureInfiniteQueryDataOptions, al as EnsureQueryDataOptions, an as FetchInfiniteQueryOptions, au as FetchNextPageOptions, av as FetchPreviousPageOptions, ak as FetchQueryOptions, ax as FetchStatus, a6 as GetNextPageParamFunction, a5 as GetPreviousPageParamFunction, V as InferDataFromTag, W as InferErrorFromTag, a7 as InfiniteData, aH as InfiniteQueryObserverBaseResult, aK as InfiniteQueryObserverLoadingErrorResult, aJ as InfiniteQueryObserverLoadingResult, ai as InfiniteQueryObserverOptions, aI as InfiniteQueryObserverPendingResult, aN as InfiniteQueryObserverPlaceholderResult, aL as InfiniteQueryObserverRefetchErrorResult, aP as InfiniteQueryObserverResult, aM as InfiniteQueryObserverSuccessResult, ad as InfiniteQueryPageParamsOptions, a1 as InitialDataFunction, ac as InitialPageParam, as as InvalidateOptions, aq as InvalidateQueryFilters, aY as MutateFunction, aX as MutateOptions, aU as MutationFunction, aQ as MutationKey, aT as MutationMeta, aZ as MutationObserverBaseResult, b0 as MutationObserverErrorResult, a_ as MutationObserverIdleResult, a$ as MutationObserverLoadingResult, aW as MutationObserverOptions, b2 as MutationObserverResult, b1 as MutationObserverSuccessResult, aV as MutationOptions, aS as MutationScope, aR as MutationStatus, a9 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b8 as NotifyEvent, b7 as NotifyEventType, aa as NotifyOnChangeProps, O as OmitKeyof, B as Override, a2 as PlaceholderDataFunction, a3 as QueriesPlaceholderDataFunction, b3 as QueryClientConfig, X as QueryFunction, a0 as QueryFunctionContext, G as QueryKey, a4 as QueryKeyHashFunction, a8 as QueryMeta, ay as QueryObserverBaseResult, aB as QueryObserverLoadingErrorResult, aA as QueryObserverLoadingResult, af as QueryObserverOptions, az as QueryObserverPendingResult, aE as QueryObserverPlaceholderResult, aC as QueryObserverRefetchErrorResult, aG as QueryObserverResult, aD as QueryObserverSuccessResult, ab as QueryOptions, $ as QueryPersister, aw as QueryStatus, ap as RefetchOptions, ar as RefetchQueryFilters, R as Register, at as ResetOptions, ao as ResultOptions, b6 as SetDataOptions, Y as StaleTime, Z as StaleTimeFunction, ae as ThrowOnError, L as UnsetMarker, ag as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, K as unsetMarker } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { j as MutationFilters, l as QueryFilters, bi as QueryTypeFilter, S as SkipToken, U as Updater, bv as addToEnd, bw as addToStart, bx as ensureQueryFn, bj as functionalUpdate, h as hashKey, bo as hashQueryKeyByOptions, br as isPlainArray, bs as isPlainObject, i as isServer, bk as isValidTimeout, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, bp as partialMatchKey, bu as replaceData, r as replaceEqualDeep, bn as resolveEnabled, bm as resolveStaleTime, bq as shallowEqualObjects, g as shouldThrowError, s as skipToken, bt as sleep, bl as timeUntilStale } from './hydration-17eepgNg.js'; | ||
export { j as MutationFilters, l as QueryFilters, bj as QueryTypeFilter, S as SkipToken, U as Updater, bw as addToEnd, bx as addToStart, by as ensureQueryFn, bk as functionalUpdate, h as hashKey, bp as hashQueryKeyByOptions, bs as isPlainArray, bt as isPlainObject, i as isServer, bl as isValidTimeout, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, bq as partialMatchKey, bv as replaceData, r as replaceEqualDeep, bo as resolveEnabled, bn as resolveStaleTime, br as shallowEqualObjects, g as shouldThrowError, s as skipToken, bu as sleep, bm as timeUntilStale } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { D as DehydrateOptions, z as DehydratedState, H as HydrateOptions, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, q as hydrate } from './hydration-17eepgNg.js'; | ||
export { D as DehydrateOptions, z as DehydratedState, H as HydrateOptions, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, q as hydrate } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,2 +0,2 @@ | ||
export { P as AnyDataTag, b4 as CancelOptions, C as CancelledError, T as DataTag, F as DefaultError, b3 as DefaultOptions, ai as DefaultedInfiniteQueryObserverOptions, ag as DefaultedQueryObserverOptions, aN as DefinedInfiniteQueryObserverResult, aE as DefinedQueryObserverResult, D as DehydrateOptions, z as DehydratedState, A as DistributiveOmit, Z as Enabled, al as EnsureInfiniteQueryDataOptions, ak as EnsureQueryDataOptions, am as FetchInfiniteQueryOptions, at as FetchNextPageOptions, au as FetchPreviousPageOptions, aj as FetchQueryOptions, aw as FetchStatus, a5 as GetNextPageParamFunction, a4 as GetPreviousPageParamFunction, H as HydrateOptions, V as InferDataFromTag, W as InferErrorFromTag, a6 as InfiniteData, aG as InfiniteQueryObserverBaseResult, aJ as InfiniteQueryObserverLoadingErrorResult, aI as InfiniteQueryObserverLoadingResult, ah as InfiniteQueryObserverOptions, aH as InfiniteQueryObserverPendingResult, aM as InfiniteQueryObserverPlaceholderResult, aK as InfiniteQueryObserverRefetchErrorResult, aO as InfiniteQueryObserverResult, aL as InfiniteQueryObserverSuccessResult, ac as InfiniteQueryPageParamsOptions, a0 as InitialDataFunction, ab as InitialPageParam, ar as InvalidateOptions, ap as InvalidateQueryFilters, aX as MutateFunction, aW as MutateOptions, y as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, j as MutationFilters, aT as MutationFunction, aP as MutationKey, aS as MutationMeta, e as MutationObserver, aY as MutationObserverBaseResult, a$ as MutationObserverErrorResult, aZ as MutationObserverIdleResult, a_ as MutationObserverLoadingResult, aV as MutationObserverOptions, b1 as MutationObserverResult, b0 as MutationObserverSuccessResult, aU as MutationOptions, aR as MutationScope, x as MutationState, aQ as MutationStatus, a8 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b7 as NotifyEvent, b6 as NotifyEventType, a9 as NotifyOnChangeProps, O as OmitKeyof, B as Override, a1 as PlaceholderDataFunction, a2 as QueriesPlaceholderDataFunction, w as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, b2 as QueryClientConfig, l as QueryFilters, X as QueryFunction, $ as QueryFunctionContext, G as QueryKey, a3 as QueryKeyHashFunction, a7 as QueryMeta, c as QueryObserver, ax as QueryObserverBaseResult, aA as QueryObserverLoadingErrorResult, az as QueryObserverLoadingResult, ae as QueryObserverOptions, ay as QueryObserverPendingResult, aD as QueryObserverPlaceholderResult, aB as QueryObserverRefetchErrorResult, aF as QueryObserverResult, aC as QueryObserverSuccessResult, aa as QueryOptions, _ as QueryPersister, v as QueryState, av as QueryStatus, ao as RefetchOptions, aq as RefetchQueryFilters, R as Register, as as ResetOptions, an as ResultOptions, b5 as SetDataOptions, S as SkipToken, Y as StaleTime, ad as ThrowOnError, L as UnsetMarker, U as Updater, af as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, h as hashKey, q as hydrate, o as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, r as replaceEqualDeep, g as shouldThrowError, s as skipToken, K as unsetMarker } from './hydration-17eepgNg.js'; | ||
export { P as AnyDataTag, b5 as CancelOptions, C as CancelledError, T as DataTag, F as DefaultError, b4 as DefaultOptions, aj as DefaultedInfiniteQueryObserverOptions, ah as DefaultedQueryObserverOptions, aO as DefinedInfiniteQueryObserverResult, aF as DefinedQueryObserverResult, D as DehydrateOptions, z as DehydratedState, A as DistributiveOmit, _ as Enabled, am as EnsureInfiniteQueryDataOptions, al as EnsureQueryDataOptions, an as FetchInfiniteQueryOptions, au as FetchNextPageOptions, av as FetchPreviousPageOptions, ak as FetchQueryOptions, ax as FetchStatus, a6 as GetNextPageParamFunction, a5 as GetPreviousPageParamFunction, H as HydrateOptions, V as InferDataFromTag, W as InferErrorFromTag, a7 as InfiniteData, aH as InfiniteQueryObserverBaseResult, aK as InfiniteQueryObserverLoadingErrorResult, aJ as InfiniteQueryObserverLoadingResult, ai as InfiniteQueryObserverOptions, aI as InfiniteQueryObserverPendingResult, aN as InfiniteQueryObserverPlaceholderResult, aL as InfiniteQueryObserverRefetchErrorResult, aP as InfiniteQueryObserverResult, aM as InfiniteQueryObserverSuccessResult, ad as InfiniteQueryPageParamsOptions, a1 as InitialDataFunction, ac as InitialPageParam, as as InvalidateOptions, aq as InvalidateQueryFilters, aY as MutateFunction, aX as MutateOptions, y as Mutation, M as MutationCache, d as MutationCacheNotifyEvent, j as MutationFilters, aU as MutationFunction, aQ as MutationKey, aT as MutationMeta, e as MutationObserver, aZ as MutationObserverBaseResult, b0 as MutationObserverErrorResult, a_ as MutationObserverIdleResult, a$ as MutationObserverLoadingResult, aW as MutationObserverOptions, b2 as MutationObserverResult, b1 as MutationObserverSuccessResult, aV as MutationOptions, aS as MutationScope, x as MutationState, aR as MutationStatus, a9 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b8 as NotifyEvent, b7 as NotifyEventType, aa as NotifyOnChangeProps, O as OmitKeyof, B as Override, a2 as PlaceholderDataFunction, a3 as QueriesPlaceholderDataFunction, w as Query, Q as QueryCache, a as QueryCacheNotifyEvent, b as QueryClient, b3 as QueryClientConfig, l as QueryFilters, X as QueryFunction, a0 as QueryFunctionContext, G as QueryKey, a4 as QueryKeyHashFunction, a8 as QueryMeta, c as QueryObserver, ay as QueryObserverBaseResult, aB as QueryObserverLoadingErrorResult, aA as QueryObserverLoadingResult, af as QueryObserverOptions, az as QueryObserverPendingResult, aE as QueryObserverPlaceholderResult, aC as QueryObserverRefetchErrorResult, aG as QueryObserverResult, aD as QueryObserverSuccessResult, ab as QueryOptions, $ as QueryPersister, v as QueryState, aw as QueryStatus, ap as RefetchOptions, ar as RefetchQueryFilters, R as Register, at as ResetOptions, ao as ResultOptions, b6 as SetDataOptions, S as SkipToken, Y as StaleTime, Z as StaleTimeFunction, ae as ThrowOnError, L as UnsetMarker, U as Updater, ag as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, u as defaultShouldDehydrateMutation, t as defaultShouldDehydrateQuery, p as dehydrate, h as hashKey, q as hydrate, o as isCancelledError, i as isServer, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, r as replaceEqualDeep, g as shouldThrowError, s as skipToken, K as unsetMarker } from './hydration-BCnR_RAv.js'; | ||
export { QueriesObserver, QueriesObserverOptions } from './queriesObserver.js'; | ||
@@ -3,0 +3,0 @@ export { InfiniteQueryObserver } from './infiniteQueryObserver.js'; |
@@ -1,2 +0,2 @@ | ||
import { b8 as QueryBehavior, a6 as InfiniteData, ac as InfiniteQueryPageParamsOptions } from './hydration-17eepgNg.js'; | ||
import { b9 as QueryBehavior, a7 as InfiniteData, ad as InfiniteQueryPageParamsOptions } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
@@ -3,0 +3,0 @@ import './subscribable.js'; |
@@ -1,2 +0,2 @@ | ||
import { F as DefaultError, a6 as InfiniteData, G as QueryKey, c as QueryObserver, aO as InfiniteQueryObserverResult, b as QueryClient, ah as InfiniteQueryObserverOptions, ai as DefaultedInfiniteQueryObserverOptions, at as FetchNextPageOptions, au as FetchPreviousPageOptions, w as Query } from './hydration-17eepgNg.js'; | ||
import { F as DefaultError, a7 as InfiniteData, G as QueryKey, c as QueryObserver, aP as InfiniteQueryObserverResult, b as QueryClient, ai as InfiniteQueryObserverOptions, aj as DefaultedInfiniteQueryObserverOptions, au as FetchNextPageOptions, av as FetchPreviousPageOptions, w as Query } from './hydration-BCnR_RAv.js'; | ||
import { Subscribable } from './subscribable.js'; | ||
@@ -3,0 +3,0 @@ import './removable.js'; |
import './removable.js'; | ||
export { bg as Action, y as Mutation, x as MutationState, bh as getDefaultState } from './hydration-17eepgNg.js'; | ||
export { bh as Action, y as Mutation, x as MutationState, bi as getDefaultState } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { M as MutationCache, d as MutationCacheNotifyEvent } from './hydration-17eepgNg.js'; | ||
export { M as MutationCache, d as MutationCacheNotifyEvent } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; | ||
import './removable.js'; |
import './subscribable.js'; | ||
export { e as MutationObserver } from './hydration-17eepgNg.js'; | ||
export { e as MutationObserver } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; |
@@ -1,2 +0,2 @@ | ||
import { aF as QueryObserverResult, b as QueryClient, ae as QueryObserverOptions, w as Query, c as QueryObserver } from './hydration-17eepgNg.js'; | ||
import { aG as QueryObserverResult, b as QueryClient, af as QueryObserverOptions, w as Query, c as QueryObserver } from './hydration-BCnR_RAv.js'; | ||
import { Subscribable } from './subscribable.js'; | ||
@@ -3,0 +3,0 @@ import './removable.js'; |
import './removable.js'; | ||
export { bd as Action, b9 as FetchContext, ba as FetchDirection, bb as FetchMeta, bc as FetchOptions, w as Query, b8 as QueryBehavior, v as QueryState, be as SetStateOptions, bf as fetchState } from './hydration-17eepgNg.js'; | ||
export { be as Action, ba as FetchContext, bb as FetchDirection, bc as FetchMeta, bd as FetchOptions, w as Query, b9 as QueryBehavior, v as QueryState, bf as SetStateOptions, bg as fetchState } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; |
@@ -7,2 +7,3 @@ // src/query.ts | ||
resolveEnabled, | ||
resolveStaleTime, | ||
skipToken, | ||
@@ -88,6 +89,11 @@ timeUntilStale | ||
} | ||
isStatic() { | ||
if (this.getObserversCount() > 0) { | ||
return this.observers.some( | ||
(observer) => resolveStaleTime(observer.options.staleTime, this) === "static" | ||
); | ||
} | ||
return false; | ||
} | ||
isStale() { | ||
if (this.state.isInvalidated) { | ||
return true; | ||
} | ||
if (this.getObserversCount() > 0) { | ||
@@ -98,6 +104,15 @@ return this.observers.some( | ||
} | ||
return this.state.data === void 0; | ||
return this.state.data === void 0 || this.state.isInvalidated; | ||
} | ||
isStaleByTime(staleTime = 0) { | ||
return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime); | ||
if (this.state.data === void 0) { | ||
return true; | ||
} | ||
if (staleTime === "static") { | ||
return false; | ||
} | ||
if (this.state.isInvalidated) { | ||
return true; | ||
} | ||
return !timeUntilStale(this.state.dataUpdatedAt, staleTime); | ||
} | ||
@@ -104,0 +119,0 @@ onFocus() { |
@@ -1,3 +0,3 @@ | ||
export { Q as QueryCache, a as QueryCacheNotifyEvent, by as QueryStore } from './hydration-17eepgNg.js'; | ||
export { Q as QueryCache, a as QueryCacheNotifyEvent, bz as QueryStore } from './hydration-BCnR_RAv.js'; | ||
import './subscribable.js'; | ||
import './removable.js'; |
@@ -1,3 +0,3 @@ | ||
export { b as QueryClient } from './hydration-17eepgNg.js'; | ||
export { b as QueryClient } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -172,3 +172,3 @@ // src/queryClient.ts | ||
const promises = notifyManager.batch( | ||
() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled()).map((query) => { | ||
() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => { | ||
let promise = query.fetch(void 0, fetchOptions); | ||
@@ -175,0 +175,0 @@ if (!fetchOptions.throwOnError) { |
import './subscribable.js'; | ||
export { c as QueryObserver } from './hydration-17eepgNg.js'; | ||
export { c as QueryObserver } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; |
@@ -442,3 +442,3 @@ // src/queryObserver.ts | ||
function shouldFetchOn(query, options, field) { | ||
if (resolveEnabled(options.enabled, query) !== false) { | ||
if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") { | ||
const value = typeof field === "function" ? field(query) : field; | ||
@@ -445,0 +445,0 @@ return value === "always" || value !== false && isStale(query, options); |
@@ -1,3 +0,3 @@ | ||
export { C as CancelledError, bB as RetryDelayValue, bA as RetryValue, bz as Retryer, bC as canFetch, bD as createRetryer, o as isCancelledError } from './hydration-17eepgNg.js'; | ||
export { C as CancelledError, bC as RetryDelayValue, bB as RetryValue, bA as Retryer, bD as canFetch, bE as createRetryer, o as isCancelledError } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,2 +0,2 @@ | ||
import { G as QueryKey, $ as QueryFunctionContext, X as QueryFunction } from './hydration-17eepgNg.js'; | ||
import { G as QueryKey, a0 as QueryFunctionContext, X as QueryFunction } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
@@ -3,0 +3,0 @@ import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { P as AnyDataTag, b4 as CancelOptions, T as DataTag, F as DefaultError, b3 as DefaultOptions, ai as DefaultedInfiniteQueryObserverOptions, ag as DefaultedQueryObserverOptions, aN as DefinedInfiniteQueryObserverResult, aE as DefinedQueryObserverResult, A as DistributiveOmit, Z as Enabled, al as EnsureInfiniteQueryDataOptions, ak as EnsureQueryDataOptions, am as FetchInfiniteQueryOptions, at as FetchNextPageOptions, au as FetchPreviousPageOptions, aj as FetchQueryOptions, aw as FetchStatus, a5 as GetNextPageParamFunction, a4 as GetPreviousPageParamFunction, V as InferDataFromTag, W as InferErrorFromTag, a6 as InfiniteData, aG as InfiniteQueryObserverBaseResult, aJ as InfiniteQueryObserverLoadingErrorResult, aI as InfiniteQueryObserverLoadingResult, ah as InfiniteQueryObserverOptions, aH as InfiniteQueryObserverPendingResult, aM as InfiniteQueryObserverPlaceholderResult, aK as InfiniteQueryObserverRefetchErrorResult, aO as InfiniteQueryObserverResult, aL as InfiniteQueryObserverSuccessResult, ac as InfiniteQueryPageParamsOptions, a0 as InitialDataFunction, ab as InitialPageParam, ar as InvalidateOptions, ap as InvalidateQueryFilters, aX as MutateFunction, aW as MutateOptions, aT as MutationFunction, aP as MutationKey, aS as MutationMeta, aY as MutationObserverBaseResult, a$ as MutationObserverErrorResult, aZ as MutationObserverIdleResult, a_ as MutationObserverLoadingResult, aV as MutationObserverOptions, b1 as MutationObserverResult, b0 as MutationObserverSuccessResult, aU as MutationOptions, aR as MutationScope, aQ as MutationStatus, a8 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b7 as NotifyEvent, b6 as NotifyEventType, a9 as NotifyOnChangeProps, O as OmitKeyof, B as Override, a1 as PlaceholderDataFunction, a2 as QueriesPlaceholderDataFunction, b2 as QueryClientConfig, X as QueryFunction, $ as QueryFunctionContext, G as QueryKey, a3 as QueryKeyHashFunction, a7 as QueryMeta, ax as QueryObserverBaseResult, aA as QueryObserverLoadingErrorResult, az as QueryObserverLoadingResult, ae as QueryObserverOptions, ay as QueryObserverPendingResult, aD as QueryObserverPlaceholderResult, aB as QueryObserverRefetchErrorResult, aF as QueryObserverResult, aC as QueryObserverSuccessResult, aa as QueryOptions, _ as QueryPersister, av as QueryStatus, ao as RefetchOptions, aq as RefetchQueryFilters, R as Register, as as ResetOptions, an as ResultOptions, b5 as SetDataOptions, Y as StaleTime, ad as ThrowOnError, L as UnsetMarker, af as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, K as unsetMarker } from './hydration-17eepgNg.js'; | ||
export { P as AnyDataTag, b5 as CancelOptions, T as DataTag, F as DefaultError, b4 as DefaultOptions, aj as DefaultedInfiniteQueryObserverOptions, ah as DefaultedQueryObserverOptions, aO as DefinedInfiniteQueryObserverResult, aF as DefinedQueryObserverResult, A as DistributiveOmit, _ as Enabled, am as EnsureInfiniteQueryDataOptions, al as EnsureQueryDataOptions, an as FetchInfiniteQueryOptions, au as FetchNextPageOptions, av as FetchPreviousPageOptions, ak as FetchQueryOptions, ax as FetchStatus, a6 as GetNextPageParamFunction, a5 as GetPreviousPageParamFunction, V as InferDataFromTag, W as InferErrorFromTag, a7 as InfiniteData, aH as InfiniteQueryObserverBaseResult, aK as InfiniteQueryObserverLoadingErrorResult, aJ as InfiniteQueryObserverLoadingResult, ai as InfiniteQueryObserverOptions, aI as InfiniteQueryObserverPendingResult, aN as InfiniteQueryObserverPlaceholderResult, aL as InfiniteQueryObserverRefetchErrorResult, aP as InfiniteQueryObserverResult, aM as InfiniteQueryObserverSuccessResult, ad as InfiniteQueryPageParamsOptions, a1 as InitialDataFunction, ac as InitialPageParam, as as InvalidateOptions, aq as InvalidateQueryFilters, aY as MutateFunction, aX as MutateOptions, aU as MutationFunction, aQ as MutationKey, aT as MutationMeta, aZ as MutationObserverBaseResult, b0 as MutationObserverErrorResult, a_ as MutationObserverIdleResult, a$ as MutationObserverLoadingResult, aW as MutationObserverOptions, b2 as MutationObserverResult, b1 as MutationObserverSuccessResult, aV as MutationOptions, aS as MutationScope, aR as MutationStatus, a9 as NetworkMode, E as NoInfer, N as NonUndefinedGuard, b8 as NotifyEvent, b7 as NotifyEventType, aa as NotifyOnChangeProps, O as OmitKeyof, B as Override, a2 as PlaceholderDataFunction, a3 as QueriesPlaceholderDataFunction, b3 as QueryClientConfig, X as QueryFunction, a0 as QueryFunctionContext, G as QueryKey, a4 as QueryKeyHashFunction, a8 as QueryMeta, ay as QueryObserverBaseResult, aB as QueryObserverLoadingErrorResult, aA as QueryObserverLoadingResult, af as QueryObserverOptions, az as QueryObserverPendingResult, aE as QueryObserverPlaceholderResult, aC as QueryObserverRefetchErrorResult, aG as QueryObserverResult, aD as QueryObserverSuccessResult, ab as QueryOptions, $ as QueryPersister, aw as QueryStatus, ap as RefetchOptions, ar as RefetchQueryFilters, R as Register, at as ResetOptions, ao as ResultOptions, b6 as SetDataOptions, Y as StaleTime, Z as StaleTimeFunction, ae as ThrowOnError, L as UnsetMarker, ag as WithRequired, J as dataTagErrorSymbol, I as dataTagSymbol, K as unsetMarker } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
@@ -1,3 +0,3 @@ | ||
export { j as MutationFilters, l as QueryFilters, bi as QueryTypeFilter, S as SkipToken, U as Updater, bv as addToEnd, bw as addToStart, bx as ensureQueryFn, bj as functionalUpdate, h as hashKey, bo as hashQueryKeyByOptions, br as isPlainArray, bs as isPlainObject, i as isServer, bk as isValidTimeout, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, bp as partialMatchKey, bu as replaceData, r as replaceEqualDeep, bn as resolveEnabled, bm as resolveStaleTime, bq as shallowEqualObjects, g as shouldThrowError, s as skipToken, bt as sleep, bl as timeUntilStale } from './hydration-17eepgNg.js'; | ||
export { j as MutationFilters, l as QueryFilters, bj as QueryTypeFilter, S as SkipToken, U as Updater, bw as addToEnd, bx as addToStart, by as ensureQueryFn, bk as functionalUpdate, h as hashKey, bp as hashQueryKeyByOptions, bs as isPlainArray, bt as isPlainObject, i as isServer, bl as isValidTimeout, k as keepPreviousData, f as matchMutation, m as matchQuery, n as noop, bq as partialMatchKey, bv as replaceData, r as replaceEqualDeep, bo as resolveEnabled, bn as resolveStaleTime, br as shallowEqualObjects, g as shouldThrowError, s as skipToken, bu as sleep, bm as timeUntilStale } from './hydration-BCnR_RAv.js'; | ||
import './removable.js'; | ||
import './subscribable.js'; |
{ | ||
"name": "@tanstack/query-core", | ||
"version": "5.77.2", | ||
"version": "5.79.0", | ||
"description": "The framework agnostic core that powers TanStack Query", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -6,2 +6,3 @@ import { | ||
resolveEnabled, | ||
resolveStaleTime, | ||
skipToken, | ||
@@ -28,2 +29,3 @@ timeUntilStale, | ||
SetDataOptions, | ||
StaleTime, | ||
} from './types' | ||
@@ -275,7 +277,16 @@ import type { QueryObserver } from './queryObserver' | ||
isStale(): boolean { | ||
if (this.state.isInvalidated) { | ||
return true | ||
isStatic(): boolean { | ||
if (this.getObserversCount() > 0) { | ||
return this.observers.some( | ||
(observer) => | ||
resolveStaleTime(observer.options.staleTime, this) === 'static', | ||
) | ||
} | ||
return false | ||
} | ||
isStale(): boolean { | ||
// check observers first, their `isStale` has the source of truth | ||
// calculated with `isStaleByTime` and it takes `enabled` into account | ||
if (this.getObserversCount() > 0) { | ||
@@ -287,11 +298,20 @@ return this.observers.some( | ||
return this.state.data === undefined | ||
return this.state.data === undefined || this.state.isInvalidated | ||
} | ||
isStaleByTime(staleTime = 0): boolean { | ||
return ( | ||
this.state.isInvalidated || | ||
this.state.data === undefined || | ||
!timeUntilStale(this.state.dataUpdatedAt, staleTime) | ||
) | ||
isStaleByTime(staleTime: StaleTime = 0): boolean { | ||
// no data is always stale | ||
if (this.state.data === undefined) { | ||
return true | ||
} | ||
// static is never stale | ||
if (staleTime === 'static') { | ||
return false | ||
} | ||
// if the query is invalidated, it is stale | ||
if (this.state.isInvalidated) { | ||
return true | ||
} | ||
return !timeUntilStale(this.state.dataUpdatedAt, staleTime) | ||
} | ||
@@ -298,0 +318,0 @@ |
@@ -327,3 +327,3 @@ import { | ||
.findAll(filters) | ||
.filter((query) => !query.isDisabled()) | ||
.filter((query) => !query.isDisabled() && !query.isStatic()) | ||
.map((query) => { | ||
@@ -330,0 +330,0 @@ let promise = query.fetch(undefined, fetchOptions) |
@@ -767,3 +767,6 @@ import { focusManager } from './focusManager' | ||
) { | ||
if (resolveEnabled(options.enabled, query) !== false) { | ||
if ( | ||
resolveEnabled(options.enabled, query) !== false && | ||
resolveStaleTime(options.staleTime, query) !== 'static' | ||
) { | ||
const value = typeof field === 'function' ? field(query) : field | ||
@@ -770,0 +773,0 @@ |
@@ -102,3 +102,5 @@ /* istanbul ignore file */ | ||
export type StaleTime< | ||
export type StaleTime = number | 'static' | ||
export type StaleTimeFunction< | ||
TQueryFnData = unknown, | ||
@@ -108,3 +110,5 @@ TError = DefaultError, | ||
TQueryKey extends QueryKey = QueryKey, | ||
> = number | ((query: Query<TQueryFnData, TError, TData, TQueryKey>) => number) | ||
> = | ||
| StaleTime | ||
| ((query: Query<TQueryFnData, TError, TData, TQueryKey>) => StaleTime) | ||
@@ -334,3 +338,3 @@ export type Enabled< | ||
*/ | ||
staleTime?: StaleTime<TQueryFnData, TError, TQueryData, TQueryKey> | ||
staleTime?: StaleTimeFunction<TQueryFnData, TError, TQueryData, TQueryKey> | ||
/** | ||
@@ -508,3 +512,3 @@ * If set to a number, the query will continuously refetch at this frequency in milliseconds. | ||
*/ | ||
staleTime?: StaleTime<TQueryFnData, TError, TData, TQueryKey> | ||
staleTime?: StaleTimeFunction<TQueryFnData, TError, TData, TQueryKey> | ||
} | ||
@@ -511,0 +515,0 @@ |
@@ -11,2 +11,3 @@ import type { | ||
StaleTime, | ||
StaleTimeFunction, | ||
} from './types' | ||
@@ -106,5 +107,7 @@ import type { Mutation } from './mutation' | ||
>( | ||
staleTime: undefined | StaleTime<TQueryFnData, TError, TData, TQueryKey>, | ||
staleTime: | ||
| undefined | ||
| StaleTimeFunction<TQueryFnData, TError, TData, TQueryKey>, | ||
query: Query<TQueryFnData, TError, TData, TQueryKey>, | ||
): number | undefined { | ||
): StaleTime | undefined { | ||
return typeof staleTime === 'function' ? staleTime(query) : staleTime | ||
@@ -111,0 +114,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
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
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
2025586
0.38%23060
0.4%