(props: { initialSearch?: string })
| 1977 | } |
| 1978 | |
| 1979 | const QueryDetails = (props: { initialSearch?: string }) => { |
| 1980 | const { selectedQueryHash, setSelectedQueryHash } = useDevtoolsState() |
| 1981 | |
| 1982 | const theme = useTheme() |
| 1983 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 1984 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 1985 | : goober.css |
| 1986 | const styles = createMemo(() => { |
| 1987 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 1988 | }) |
| 1989 | |
| 1990 | const { colors } = tokens |
| 1991 | const t = (light: string, dark: string) => (theme() === 'dark' ? dark : light) |
| 1992 | |
| 1993 | const queryClient = useQueryDevtoolsContext().client |
| 1994 | |
| 1995 | const [restoringLoading, setRestoringLoading] = createSignal(false) |
| 1996 | const [dataMode, setDataMode] = createSignal<'view' | 'edit'>('view') |
| 1997 | const [dataEditError, setDataEditError] = createSignal<boolean>(false) |
| 1998 | |
| 1999 | const errorTypes = createMemo(() => { |
| 2000 | return useQueryDevtoolsContext().errorTypes || [] |
| 2001 | }) |
| 2002 | |
| 2003 | const activeQuery = createSubscribeToQueryCacheBatcher( |
| 2004 | (queryCache) => queryCache().get(selectedQueryHash() ?? ''), |
| 2005 | false, |
| 2006 | ) |
| 2007 | |
| 2008 | const activeQueryFresh = createSubscribeToQueryCacheBatcher((queryCache) => { |
| 2009 | return queryCache().get(selectedQueryHash() ?? '') |
| 2010 | }, false) |
| 2011 | |
| 2012 | const activeQueryState = createSubscribeToQueryCacheBatcher( |
| 2013 | (queryCache) => queryCache().get(selectedQueryHash() ?? '')?.state, |
| 2014 | false, |
| 2015 | ) |
| 2016 | |
| 2017 | const activeQueryStateData = createSubscribeToQueryCacheBatcher( |
| 2018 | (queryCache) => { |
| 2019 | return queryCache().get(selectedQueryHash() ?? '')?.state.data |
| 2020 | }, |
| 2021 | false, |
| 2022 | ) |
| 2023 | |
| 2024 | const statusLabel = createSubscribeToQueryCacheBatcher((queryCache) => { |
| 2025 | const query = queryCache().get(selectedQueryHash() ?? '') |
| 2026 | if (!query) return 'inactive' |
| 2027 | return getQueryStatusLabel(query) |
| 2028 | }) |
| 2029 | |
| 2030 | const queryStatus = createSubscribeToQueryCacheBatcher((queryCache) => { |
| 2031 | const query = queryCache().get(selectedQueryHash() ?? '') |
| 2032 | if (!query) return 'pending' |
| 2033 | return query.state.status |
| 2034 | }) |
| 2035 | |
| 2036 | const observerCount = createSubscribeToQueryCacheBatcher( |
nothing calls this directly
no test coverage detected