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```bash
21npm i @tanstack/solid-query-devtools
22```
23β
24or
25β
26```bash
27pnpm add @tanstack/solid-query-devtools
28```
29β
30or
31β
32```bash
33yarn add @tanstack/solid-query-devtools
34```
35β
36or
37β
38```bash
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 included in bundles when `isServer === true` ([`isServer`](https://github.com/solidjs/solid/blob/a72d393a07b22f9b7496e5eb93712188ccce0d28/packages/solid/web/src/index.ts#L37) comes from the `solid-js/web` package), so you don't need to worry about excluding them during a production build.
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- `theme?: "light" | "dark" | "system"`
89 - Defaults to `system`.
90 - Set this to change the theme of the devtools panel.
91β
92## Embedded Mode
93β
94Embedded mode will show the development tools as a fixed element in your application, so you can use our panel in your own development tools.
95β
96Place 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!
97β
98```tsx
99import { createSignal, Show } from 'solid-js'
100import { SolidQueryDevtoolsPanel } from '@tanstack/solid-query-devtools'
101β
102function App() {
103 const [isOpen, setIsOpen] = createSignal(false)
104β
105 return (
106 <QueryClientProvider client={queryClient}>
107 {/* The rest of your application */}
108 <button
109 onClick={() => setIsOpen(!isOpen())}
110 >{`${isOpen() ? 'Close' : 'Open'} the devtools panel`}</button>
111 <Show when={isOpen()}>
112 <SolidQueryDevtoolsPanel onClose={() => setIsOpen(false)} />
113 </Show>
114 </QueryClientProvider>
115 )
116}
117```
118β
119### Options
120β
121- `style?: JSX.CSSProperties`
122 - Custom styles for the devtools panel
123 - Default: `{ height: '500px' }`
124 - Example: `{ height: '100%' }`
125 - Example: `{ height: '100%', width: '100%' }`
126- `onClose?: () => void`
127 - Callback function that is called when the devtools panel is closed
128- `client?: QueryClient`,
129 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
130- `errorTypes?: { name: string; initializer: (query: Query) => TError}[]`
131 - 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.
132- `styleNonce?: string`
133 - 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.
134- `shadowDOMTarget?: ShadowRoot`
135 - Default behavior will apply the devtool's styles to the head tag within the DOM.
136 - 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.
137- `theme?: "light" | "dark" | "system"`
138 - Defaults to `system`.
139 - Set this to change the theme of the devtools panel.