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 Google Chrome users: A third-party Chrome extension is available for debugging TanStack Query directly in Chrome DevTools. This provides the same functionality as the framework-specific devtools packages. Check it out here: [TanStack Query DevTools](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
11β
12## Component based Devtools (Vue 3)
13β
14You can directly integrate the devtools component into your page using a dedicated package.
15Component-based devtools use a framework-agnostic implementation and are always up-to-date.
16β
17The devtools component is a separate package that you need to install:
18β
19```bash
20npm i @tanstack/vue-query-devtools
21```
22β
23or
24β
25```bash
26pnpm add @tanstack/vue-query-devtools
27```
28β
29or
30β
31```bash
32yarn add @tanstack/vue-query-devtools
33```
34β
35or
36β
37```bash
38bun add @tanstack/vue-query-devtools
39```
40β
41By 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.
42β
43Devtools 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.
44β
45Place 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!
46β
47```vue
48<script setup>
49import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
50</script>
51β
52<template>
53 <h1>The app!</h1>
54 <VueQueryDevtools />
55</template>
56```
57β
58### Options
59β
60- `initialIsOpen: Boolean`
61 - Set this `true` if you want the dev tools to default to being open.
62- `buttonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right"`
63 - Defaults to `bottom-right`.
64 - The position of the React Query logo to open and close the devtools panel.
65- `position?: "top" | "bottom" | "left" | "right"`
66 - Defaults to `bottom`.
67 - The position of the React Query devtools panel.
68- `client?: QueryClient`
69 - Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
70- `errorTypes?: { name: string; initializer: (query: Query) => TError}`
71 - 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.
72- `styleNonce?: string`
73 - 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.
74- `shadowDOMTarget?: ShadowRoot`
75 - Default behavior will apply the devtool's styles to the head tag within the DOM.
76 - 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.
77β
78## Traditional Devtools
79β
80Vue Query will seamlessly integrate with the [Official Vue devtools](https://github.com/vuejs/devtools-next), adding custom inspector and timeline events.
81Devtool code will be treeshaken from production bundles by default.
82β
83To make it work, you only need to enable it in the plugin options:
84β
85```ts
86app.use(VueQueryPlugin, {
87 enableDevtoolsV6Plugin: true,
88})
89```
90β
91Both v6 and v7 versions of devtools are supported.