Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tanstack/query/llms.txt
Use this file to discover all available pages before exploring further.
Vue Query DevTools
Vue Query integrates with Vue DevTools to provide powerful debugging and inspection capabilities for your queries and mutations.Overview
The Vue Query DevTools plugin adds a dedicated inspector to Vue DevTools where you can:- View all active queries in your application
- Inspect query state, data, and metadata
- Manually trigger refetches, invalidations, and resets
- Monitor query cache updates in real-time
- Debug query lifecycle events with timeline integration
- Toggle online/offline mode for testing
- Force loading or error states for development
Vue Query DevTools are automatically disabled in production builds. They only work in
development mode.Installation
DevTools are included in the main@tanstack/vue-query package. No additional installation is required.
Setup
import { createApp } from 'vue'
import { VueQueryPlugin } from '@tanstack/vue-query'
import App from './App.vue'
const app = createApp(App)
app.use(VueQueryPlugin, {
enableDevtoolsV6Plugin: true,
})
app.mount('#app')
DevTools Interface
Query Inspector
The main inspector shows all queries in your cache:- Status Badge: Color-coded query state (🟢 success, 🔴 error, 🟡 pending)
- Query Key: The unique identifier for the query
- Observer Count: Number of active observers
[n]
Query Details Panel
Click any query to see detailed information:Query Details
- Query Key: The full query key
- Query Status: Current status (success, error, pending)
- Observers: Number of components watching this query
- Last Updated: Timestamp of last successful fetch
Data Explorer
Inspect the current query data with full object explorer:Query Explorer
View the complete Query object including:- State (data, error, status, timestamps)
- Options (staleTime, cacheTime, retry config)
- Observers array
- Internal metadata
Query Actions
The DevTools provide quick actions for each query:// Forces the query into error state
query.setState({
data: undefined,
status: 'error',
error: new Error('Unknown error from devtools'),
})
Timeline Integration
Vue Query integrates with Vue DevTools Timeline to track query events:Query Events
The timeline shows:- Query Added: When a new query is created
- Query Updated: When query data changes
- Query Removed: When a query is removed from cache
- Query hash for identification
- Timestamp
- Full event data
DevTools Settings
Customize DevTools behavior with built-in settings:Sort Cache Entries
Change the sort order of queries:- ASC: Ascending order (default)
- DESC: Descending order
Sort Function
Choose how queries are sorted:- By query key
- By last update time
- By observer count
- By status
Online Mode
Toggle online/offline mode to test reconnection behavior:- Online: Normal operation (default)
- Offline: Simulates network disconnection
Filtering Queries
Use the search box to filter queries by query key:DevTools Configuration
Customize DevTools behavior when setting up the plugin:Environment-Based Setup
Only enable DevTools in development:Debugging Common Issues
Queries Not Showing Up
- Verify plugin is enabled: Check that
enableDevtoolsV6Plugin: trueis set - Check environment: DevTools only work in development mode
- Confirm Vue DevTools is installed: Ensure the browser extension is active
- Restart DevTools: Close and reopen browser DevTools
DevTools Performance Impact
DevTools add minimal overhead, but with many queries:DevTools code is tree-shaken from production builds, so there’s zero runtime cost in production.
Multiple QueryClient Instances
When using multiple clients, specify which to debug:DevTools API
Vue Query uses@vue/devtools-api for integration:
You don’t need to interact with the DevTools API directly. Vue Query handles all integration automatically.
Best Practices
Development Workflow
- Use Query Keys Consistently: Descriptive query keys make debugging easier
- Monitor Observer Counts: High counts may indicate unnecessary re-renders
- Check Stale/Fresh Status: Verify your
staleTimeconfiguration is working - Test Error States: Use “Force Error” to test error handling
- Inspect Timeline: Track query lifecycle to understand refetch behavior
Debugging Strategies
Component.vue
Performance Monitoring
Use DevTools to identify performance issues:- Too Many Observers: May indicate component re-render issues
- Frequent Updates: Check if
staleTimeis too aggressive - Large Cache: Consider reducing
gcTimeor usingremoveQueries
Next Steps
Quick Start
Learn basic usage
TypeScript
Type-safe development
API Reference
Complete API documentation
Examples
Real-world examples