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

Function getQueryStatusColor

packages/query-devtools/src/utils.tsx:48–66  ·  view source on GitHub ↗
({
  queryState,
  observerCount,
  isStale,
}: {
  queryState: Query['state'] | undefined
  observerCount: number
  isStale: boolean
})

Source from the content-addressed store, hash-verified

46 * @returns The color name.
47 */
48export function getQueryStatusColor({
49 queryState,
50 observerCount,
51 isStale,
52}: {
53 queryState: Query['state'] | undefined
54 observerCount: number
55 isStale: boolean
56}) {
57 return queryState?.fetchStatus === 'fetching'
58 ? 'blue'
59 : !observerCount
60 ? 'gray'
61 : queryState?.fetchStatus === 'paused'
62 ? 'purple'
63 : isStale
64 ? 'yellow'
65 : 'green'
66}
67
68/**
69 * Returns the color of a mutation's status: purple while paused, red on error, yellow while pending,

Callers 2

QueryRowFunction · 0.90
utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected