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

Function getQueryStatusLabel

packages/query-devtools/src/utils.tsx:13–23  ·  view source on GitHub ↗
(query: Query)

Source from the content-addressed store, hash-verified

11 * @returns One of `'fetching'`, `'inactive'`, `'paused'`, `'stale'`, or `'fresh'`.
12 */
13export function getQueryStatusLabel(query: Query) {
14 return query.state.fetchStatus === 'fetching'
15 ? 'fetching'
16 : !query.getObserversCount()
17 ? 'inactive'
18 : query.state.fetchStatus === 'paused'
19 ? 'paused'
20 : query.isStale()
21 ? 'stale'
22 : 'fresh'
23}
24
25type QueryStatusLabel = 'fresh' | 'stale' | 'paused' | 'inactive' | 'fetching'
26

Callers 3

QueryStatusCountFunction · 0.90
QueryDetailsFunction · 0.90
utils.test.tsFile · 0.90

Calls 2

getObserversCountMethod · 0.80
isStaleMethod · 0.80

Tested by

no test coverage detected