MCPcopy Create free account
hub / github.com/TanStack/query / isStale

Function isStale

packages/query-core/src/queryObserver.ts:969–977  ·  view source on GitHub ↗

* Checks whether a query is stale for the given observer options. * @param query - The query to check. * @param options - The observer options, whose `enabled` and `staleTime` are used. * @returns `true` if the query is enabled and its data is stale for `staleTime`.

(
  query: Query<any, any, any, any>,
  options: QueryObserverOptions<any, any, any, any, any>,
)

Source from the content-addressed store, hash-verified

967 * @returns `true` if the query is enabled and its data is stale for `staleTime`.
968 */
969function isStale(
970 query: Query<any, any, any, any>,
971 options: QueryObserverOptions<any, any, any, any, any>,
972): boolean {
973 return (
974 resolveQueryValue(options.enabled, query) !== false &&
975 query.isStaleByTime(resolveQueryValue(options.staleTime, query))
976 )
977}

Callers 4

QueryRowFunction · 0.85
createResultMethod · 0.85
shouldFetchOnFunction · 0.85
shouldFetchOptionallyFunction · 0.85

Calls 2

resolveQueryValueFunction · 0.90
isStaleByTimeMethod · 0.80

Tested by

no test coverage detected