Open History to see the last commit
1import { createContext, useContext } from 'solid-js'
2import type { QueryClient, onlineManager } from '@tanstack/query-core'
3import type { QueryDevtoolsProps } from './types'
4β
5export type {
6 DevtoolsButtonPosition,
7 DevtoolsErrorType,
8 DevtoolsPosition,
9 QueryDevtoolsProps,
10 Theme,
11} from './types'
12β
13export const QueryDevtoolsContext = createContext<QueryDevtoolsProps>({
14 client: undefined as unknown as QueryClient,
15 onlineManager: undefined as unknown as typeof onlineManager,
16 queryFlavor: '',
17 version: '',
18 shadowDOMTarget: undefined,
19})
20β
21/**
22 * Returns the devtools configuration from context, such as the `client` and the `onlineManager`.
23 * @returns The devtools configuration.
24 */
25export function useQueryDevtoolsContext() {
26 return useContext(QueryDevtoolsContext)
27}