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

Function ContentView

packages/query-devtools/src/Devtools.tsx:609–1315  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

607}
608
609export const ContentView: Component<ContentViewProps> = (props) => {
610 setupQueryCacheSubscription()
611 setupMutationCacheSubscription()
612 let containerRef!: HTMLDivElement
613 const theme = useTheme()
614 const css = useQueryDevtoolsContext().shadowDOMTarget
615 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
616 : goober.css
617 const styles = createMemo(() => {
618 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
619 })
620
621 const pip = usePiPWindow()
622
623 const [selectedView, setSelectedView] = createSignal<'queries' | 'mutations'>(
624 'queries',
625 )
626
627 const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME)
628 const sortOrder = createMemo(
629 () => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER,
630 ) as () => 1 | -1
631
632 const mutationSort = createMemo(
633 () => props.localStore.mutationSort || DEFAULT_MUTATION_SORT_FN_NAME,
634 )
635 const mutationSortOrder = createMemo(
636 () => Number(props.localStore.mutationSortOrder) || DEFAULT_SORT_ORDER,
637 ) as () => 1 | -1
638
639 const sortFn = createMemo(() => sortFns[sort() as string])
640 const mutationSortFn = createMemo(
641 () => mutationSortFns[mutationSort() as string],
642 )
643
644 const onlineManager = createMemo(
645 () => useQueryDevtoolsContext().onlineManager,
646 )
647
648 const query_cache = createMemo(() => {
649 return useQueryDevtoolsContext().client.getQueryCache()
650 })
651
652 const mutation_cache = createMemo(() => {
653 return useQueryDevtoolsContext().client.getMutationCache()
654 })
655
656 const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
657 return queryCache().getAll().length
658 }, false)
659
660 const queries = createMemo(
661 on(
662 () => [
663 queryCount(),
664 props.localStore.filter,
665 sort(),
666 sortOrder(),

Callers

nothing calls this directly

Calls 15

useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
usePiPWindowFunction · 0.90
sendDevToolsEventFunction · 0.85
setComputedVariablesFunction · 0.85
setDevtoolsPositionFunction · 0.85
getQueryCacheMethod · 0.80
getMutationCacheMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…