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> Also note that you can use these devtools to observe queries, but **not mutations** (yet).
11β
12## Install and Import the Devtools
13β
14The devtools are a separate package that you need to install:
15β
16```bash
17$ npm i @tanstack/solid-query-devtools
18# or
19$ pnpm add @tanstack/solid-query-devtools
20# or
21$ yarn add @tanstack/solid-query-devtools
22```
23β
24You can import the devtools like this:
25β
26```tsx
27import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
28```
29β
30By default, Solid Query Devtools are only included in bundles when `process.env.NODE_ENV === 'development'`, so you don't need to worry about excluding them during a production build.
31β
32## Floating Mode
33β
34Floating 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.
35β
36Place 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!
37β
38```tsx
39import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
40β
41function App() {
42 return (
43 <QueryClientProvider client={queryClient}>
44 {/* The rest of your application */}
45 <SolidQueryDevtools initialIsOpen={false} />
46 </QueryClientProvider>
47 )
48}
49```
50β
51### Options
52β
53- `initialIsOpen: Boolean`
54 - Set this `true` if you want the dev tools to default to being open
55- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
56 - Defaults to `bottom-right`
57 - The position of the Solid Query logo to open and close the devtools panel
58- `position?: "top" | "bottom" | "left" | "right"`
59 - Defaults to `bottom`
60 - The position of the Solid Query devtools panel
61- `client?: QueryClient`,
62 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
63- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
64 - 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.
65- `styleNonce?: string`
66 - 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.