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

Function QueryStatusCount

packages/query-devtools/src/Devtools.tsx:1594–1649  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1592}
1593
1594const QueryStatusCount: Component = () => {
1595 const stale = createSubscribeToQueryCacheBatcher(
1596 (queryCache) =>
1597 queryCache()
1598 .getAll()
1599 .filter((q) => getQueryStatusLabel(q) === 'stale').length,
1600 )
1601
1602 const fresh = createSubscribeToQueryCacheBatcher(
1603 (queryCache) =>
1604 queryCache()
1605 .getAll()
1606 .filter((q) => getQueryStatusLabel(q) === 'fresh').length,
1607 )
1608
1609 const fetching = createSubscribeToQueryCacheBatcher(
1610 (queryCache) =>
1611 queryCache()
1612 .getAll()
1613 .filter((q) => getQueryStatusLabel(q) === 'fetching').length,
1614 )
1615
1616 const paused = createSubscribeToQueryCacheBatcher(
1617 (queryCache) =>
1618 queryCache()
1619 .getAll()
1620 .filter((q) => getQueryStatusLabel(q) === 'paused').length,
1621 )
1622
1623 const inactive = createSubscribeToQueryCacheBatcher(
1624 (queryCache) =>
1625 queryCache()
1626 .getAll()
1627 .filter((q) => getQueryStatusLabel(q) === 'inactive').length,
1628 )
1629
1630 const theme = useTheme()
1631 const css = useQueryDevtoolsContext().shadowDOMTarget
1632 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1633 : goober.css
1634 const styles = createMemo(() => {
1635 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1636 })
1637
1638 return (
1639 <div
1640 class={cx(styles().queryStatusContainer, 'tsqd-query-status-container')}
1641 >
1642 <QueryStatus label="Fresh" color="green" count={fresh()} />
1643 <QueryStatus label="Fetching" color="blue" count={fetching()} />
1644 <QueryStatus label="Paused" color="purple" count={paused()} />
1645 <QueryStatus label="Stale" color="yellow" count={stale()} />
1646 <QueryStatus label="Inactive" color="gray" count={inactive()} />
1647 </div>
1648 )
1649}
1650
1651const MutationStatusCount: Component = () => {

Callers

nothing calls this directly

Calls 7

getQueryStatusLabelFunction · 0.90
useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
darkStylesFunction · 0.70
lightStylesFunction · 0.70
getAllMethod · 0.45

Tested by

no test coverage detected