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

Function MutationStatusCount

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

Source from the content-addressed store, hash-verified

1831}
1832
1833const MutationStatusCount: Component = () => {
1834 const counts = createSubscribeToMutationCacheBatcher((mutationCache) => {
1835 const tally = { green: 0, yellow: 0, purple: 0, red: 0, gray: 0 }
1836 for (const mutation of mutationCache().getAll()) {
1837 tally[getMutationStatusColor(mutation.state)]++
1838 }
1839 return tally
1840 })
1841
1842 const theme = useTheme()
1843 const css = useQueryDevtoolsContext().shadowDOMTarget
1844 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1845 : goober.css
1846 const styles = createMemo(() => {
1847 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1848 })
1849
1850 return (
1851 <div
1852 class={cx(styles().queryStatusContainer, 'tsqd-query-status-container')}
1853 >
1854 <QueryStatus label="Paused" color="purple" count={counts().purple} />
1855 <QueryStatus label="Pending" color="yellow" count={counts().yellow} />
1856 <QueryStatus label="Success" color="green" count={counts().green} />
1857 <QueryStatus label="Error" color="red" count={counts().red} />
1858 </div>
1859 )
1860}
1861
1862const QueryStatus: Component<QueryStatusProps> = (props) => {
1863 const { selectedQueryHash, panelWidth } = useDevtoolsState()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected