MCPcopy
hub / github.com/TanStack/query / QueryStatusCount

Function QueryStatusCount

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

Source from the content-addressed store, hash-verified

1551}
1552
1553const QueryStatusCount: Component = () => {
1554 const stale = createSubscribeToQueryCacheBatcher(
1555 (queryCache) =>
1556 queryCache()
1557 .getAll()
1558 .filter((q) => getQueryStatusLabel(q) === 'stale').length,
1559 )
1560
1561 const fresh = createSubscribeToQueryCacheBatcher(
1562 (queryCache) =>
1563 queryCache()
1564 .getAll()
1565 .filter((q) => getQueryStatusLabel(q) === 'fresh').length,
1566 )
1567
1568 const fetching = createSubscribeToQueryCacheBatcher(
1569 (queryCache) =>
1570 queryCache()
1571 .getAll()
1572 .filter((q) => getQueryStatusLabel(q) === 'fetching').length,
1573 )
1574
1575 const paused = createSubscribeToQueryCacheBatcher(
1576 (queryCache) =>
1577 queryCache()
1578 .getAll()
1579 .filter((q) => getQueryStatusLabel(q) === 'paused').length,
1580 )
1581
1582 const inactive = createSubscribeToQueryCacheBatcher(
1583 (queryCache) =>
1584 queryCache()
1585 .getAll()
1586 .filter((q) => getQueryStatusLabel(q) === 'inactive').length,
1587 )
1588
1589 const theme = useTheme()
1590 const css = useQueryDevtoolsContext().shadowDOMTarget
1591 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1592 : goober.css
1593 const styles = createMemo(() => {
1594 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1595 })
1596
1597 return (
1598 <div
1599 class={cx(styles().queryStatusContainer, 'tsqd-query-status-container')}
1600 >
1601 <QueryStatus label="Fresh" color="green" count={fresh()} />
1602 <QueryStatus label="Fetching" color="blue" count={fetching()} />
1603 <QueryStatus label="Paused" color="purple" count={paused()} />
1604 <QueryStatus label="Stale" color="yellow" count={stale()} />
1605 <QueryStatus label="Inactive" color="gray" count={inactive()} />
1606 </div>
1607 )
1608}
1609
1610const 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…