Open History to see the last commit
1---
2id: devtools
3title: Devtools
4---
5β
6Wave your hands in the air and shout hooray because Vue Query comes with dedicated devtools! π₯³
7β
8When you begin your Vue Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Vue 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" /> [Devtools for Chrome](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
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" /> [Devtools for Firefox](https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/)
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" /> [Devtools for Edge](https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj)
15β
16## Component based Devtools (Vue 3)
17β
18You can directly integrate the devtools component into your page using a dedicated package.
19Component-based devtools use a framework-agnostic implementation and are always up-to-date.
20β
21The devtools component is a separate package that you need to install:
22β
23```bash
24npm i @tanstack/vue-query-devtools
25```
26β
27or
28β
29```bash
30pnpm add @tanstack/vue-query-devtools
31```
32β
33or
34β
35```bash
36yarn add @tanstack/vue-query-devtools
37```
38β
39or
40β
41```bash
42bun add @tanstack/vue-query-devtools
43```
44β
45By default, Vue 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.
46β
47Devtools will be mounted 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.
48β
49Place the following code as high in your Vue app as you can. The closer it is to the root of the page, the better it will work!
50β
51```vue
52<script setup>
53import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
54</script>
55β
56<template>
57 <h1>The app!</h1>
58 <VueQueryDevtools />
59</template>
60```
61β
62### Options
63β
64- `initialIsOpen: Boolean`
65 - Set this `true` if you want the dev tools to default to being open.
66- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
67 - Defaults to `bottom-right`.
68 - The position of the React Query logo to open and close the devtools panel.
69- `position?: "top" | "bottom" | "left" | "right"`
70 - Defaults to `bottom`.
71 - The position of the React Query devtools panel.
72- `client?: QueryClient`
73 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
74- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
75 - Use this to predefine some errors that can be triggered on your queries. The initializer will be called (with the specific query) when that error is toggled on from the UI. It must return an Error.
76- `styleNonce?: string`
77 - 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.
78- `shadowDOMTarget?: ShadowRoot`
79 - Default behavior will apply the devtool's styles to the head tag within the DOM.
80 - 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.
81β
82## Traditional Devtools
83β
84Vue Query will seamlessly integrate with the [Official Vue devtools](https://github.com/vuejs/devtools-next), adding custom inspector and timeline events.
85Devtool code will be treeshaken from production bundles by default.
86β
87To make it work, you only need to enable it in the plugin options:
88β
89```ts
90app.use(VueQueryPlugin, {
91 enableDevtoolsV6Plugin: true,
92})
93```
94β
95Both v6 and v7 versions of devtools are supported.