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

Function ContentView

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

Source from the content-addressed store, hash-verified

672}
673
674export const ContentView: Component<ContentViewProps> = (props) => {
675 setupQueryCacheSubscription()
676 setupMutationCacheSubscription()
677 let containerRef!: HTMLDivElement
678 const theme = useTheme()
679 const css = useQueryDevtoolsContext().shadowDOMTarget
680 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
681 : goober.css
682 const styles = createMemo(() => {
683 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
684 })
685
686 const pip = usePiPWindow()
687
688 const [selectedView, setSelectedView] = createSignal<'queries' | 'mutations'>(
689 'queries',
690 )
691
692 const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME)
693 const sortOrder = createMemo(
694 () => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER,
695 ) as () => 1 | -1
696
697 const mutationSort = createMemo(
698 () => props.localStore.mutationSort || DEFAULT_MUTATION_SORT_FN_NAME,
699 )
700 const mutationSortOrder = createMemo(
701 () => Number(props.localStore.mutationSortOrder) || DEFAULT_SORT_ORDER,
702 ) as () => 1 | -1
703
704 const sortFn = createMemo(() => sortFns[sort() as string])
705 const mutationSortFn = createMemo(
706 () => mutationSortFns[mutationSort() as string],
707 )
708
709 const onlineManager = createMemo(
710 () => useQueryDevtoolsContext().onlineManager,
711 )
712
713 const query_cache = createMemo(() => {
714 return useQueryDevtoolsContext().client.getQueryCache()
715 })
716
717 const mutation_cache = createMemo(() => {
718 return useQueryDevtoolsContext().client.getMutationCache()
719 })
720
721 const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
722 return queryCache().getAll().length
723 }, false)
724
725 const queries = createMemo(
726 on(
727 () => [
728 queryCount(),
729 props.localStore.filter,
730 sort(),
731 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