Wave your hands in the air and shout hooray because Vue Query comes with dedicated devtools! 🥳
When 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!
You can directly integrate the devtools component into your page using a dedicated package. Component-based devtools use a framework-agnostic implementation and are always up-to-date.
The devtools component is a separate package that you need to install:
npm i @tanstack/vue-query-devtools
npm i @tanstack/vue-query-devtools
or
pnpm add @tanstack/vue-query-devtools
pnpm add @tanstack/vue-query-devtools
or
yarn add @tanstack/vue-query-devtools
yarn add @tanstack/vue-query-devtools
or
bun add @tanstack/vue-query-devtools
bun add @tanstack/vue-query-devtools
By 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.
Devtools 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.
Place 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!
<script setup>
import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
</script>
<template>
<h1>The app!</h1>
<VueQueryDevtools />
</template>
<script setup>
import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
</script>
<template>
<h1>The app!</h1>
<VueQueryDevtools />
</template>
Vue Query will seamlessly integrate with the Official Vue devtools, adding custom inspector and timeline events. Devtool code will be treeshaken from production bundles by default.
To make it work, you only need to enable it in the plugin options:
app.use(VueQueryPlugin, {
enableDevtoolsV6Plugin: true,
})
app.use(VueQueryPlugin, {
enableDevtoolsV6Plugin: true,
})
Both v6 and v7 versions of devtools are supported.