Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6Wave your hands in the air and shout hooray because Solid Query comes with dedicated devtools! π₯³
7β
8When you begin your Solid Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Solid Query and will likely save you hours of debugging if you find yourself in a pinch!
9β
10> For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
11>
12> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai">Devtools for Chrome</a>
13> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/">Devtools for Firefox</a>
14> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj">Devtools for Edge</a>
15β
16## Install and Import the Devtools
17β
18The devtools are a separate package that you need to install:
19β
20```sh
21npm i @tanstack/solid-query-devtools
22```
23β
24or
25β
26```sh
27pnpm add @tanstack/solid-query-devtools
28```
29β
30or
31β
32```sh
33yarn add @tanstack/solid-query-devtools
34```
35β
36or
37β
38```sh
39bun add @tanstack/solid-query-devtools
40```
41β
42You can import the devtools like this:
43β
44```tsx
45import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
46```
47β
48By default, Solid Query Devtools are only enabled in development mode (`isDev` from `solid-js/web`). In production, the devtools components render nothing. During development, the devtools are loaded only on the client and are not rendered on the server.
49β
50## Floating Mode
51β
52Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
53β
54Place the following code as high in your Solid app as you can. The closer it is to the root of the page, the better it will work!
55β
56```tsx
57import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
58β
59function App() {
60 return (
61 <QueryClientProvider client={queryClient}>
62 {/* The rest of your application */}
63 <SolidQueryDevtools initialIsOpen={false} />
64 </QueryClientProvider>
65 )
66}
67```
68β
69### Options
70β
71- `initialIsOpen: boolean`
72 - Set this `true` if you want the dev tools to default to being open
73- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "relative"`
74 - Defaults to `bottom-right`
75 - The position of the TanStack logo to open and close the devtools panel
76- `position?: "top" | "bottom" | "left" | "right"`
77 - Defaults to `bottom`
78 - The position of the Solid Query devtools panel
79- `client?: QueryClient`,
80 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
81- `errorTypes?: { name: string; initializer: (query: Query) => TError}[]`
82 - Use this to predefine some errors that can be triggered on your queries. Initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
83- `styleNonce?: string`
84 - Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
85- `shadowDOMTarget?: ShadowRoot`
86 - Default behavior will apply the devtool's styles to the head tag within the DOM.
87 - Use this to pass a shadow DOM target to the devtools so that the styles will be applied within the shadow DOM instead of within the head tag in the light DOM.
88- `hideDisabledQueries?: boolean`
89 - Defaults to `false`.
90 - Set this to true to hide disabled queries from the devtools panel.
91- `theme?: "light" | "dark" | "system"`
92 - Defaults to the theme selected in the devtools Settings menu, or `system` if none is selected.
93 - Set this to change the theme of the devtools panel. This overrides the theme selected in the Settings menu.
94β
95## Embedded Mode
96β
97Embedded mode will show the development tools as a fixed element in your application, so you can use our panel in your own development tools.
98β
99Place the following code as high in your Solid app as you can. The closer it is to the root of the page, the better it will work!
100β
101```tsx
102import { createSignal, Show } from 'solid-js'
103import { SolidQueryDevtoolsPanel } from '@tanstack/solid-query-devtools'
104β
105function App() {
106 const [isOpen, setIsOpen] = createSignal(false)
107β
108 return (
109 <QueryClientProvider client={queryClient}>
110 {/* The rest of your application */}
111 <button
112 onClick={() => setIsOpen(!isOpen())}
113 >{`${isOpen() ? 'Close' : 'Open'} the devtools panel`}</button>
114 <Show when={isOpen()}>
115 <SolidQueryDevtoolsPanel onClose={() => setIsOpen(false)} />
116 </Show>
117 </QueryClientProvider>
118 )
119}
120```
121β
122### Options
123β
124- `style?: JSX.CSSProperties`
125 - Custom styles for the devtools panel
126 - Default: `{ height: '500px' }`
127 - Example: `{ height: '100%' }`
128 - Example: `{ height: '100%', width: '100%' }`
129- `onClose?: () => void`
130 - Callback function that is called when the devtools panel is closed
131- `client?: QueryClient`,
132 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
133- `errorTypes?: { name: string; initializer: (query: Query) => TError}[]`
134 - Use this to predefine some errors that can be triggered on your queries. Initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
135- `styleNonce?: string`
136 - Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
137- `shadowDOMTarget?: ShadowRoot`
138 - Default behavior will apply the devtool's styles to the head tag within the DOM.
139 - Use this to pass a shadow DOM target to the devtools so that the styles will be applied within the shadow DOM instead of within the head tag in the light DOM.
140- `hideDisabledQueries?: boolean`
141 - Defaults to `false`.
142 - Set this to true to hide disabled queries from the devtools panel.
143- `theme?: "light" | "dark" | "system"`
144 - Defaults to the theme selected in the devtools Settings menu, or `system` if none is selected.
145 - Set this to change the theme of the devtools panel. This overrides the theme selected in the Settings menu.