The TanStack Query DevTools provide a visual interface to inspect, debug, and understand your application’s queries and mutations.
Installation
React
Other Frameworks
Basic Setup
React
The DevTools are automatically excluded from production builds when using NODE_ENV === 'production'.
Vue
Solid
Features
Query Inspector
Inspect all queries in your application:
- View query status (pending, success, error)
- See query data and error details
- Inspect query configuration
- View data update timestamps
- Check fetch status and stale state
Mutation Inspector
Monitor mutations:
- Track pending mutations
- View mutation variables
- Inspect mutation results and errors
- See mutation timeline
Manual Refetching
Trigger refetches from the DevTools:
Query Invalidation
Invalidate queries directly from DevTools:
Data Editor
Edit query data directly in DevTools for testing:
Floating Mode
Mount DevTools as a floating panel:
Click the TanStack Query logo to toggle the panel.
Embed DevTools directly in your app UI:
Panel Options
Load DevTools only when needed to reduce bundle size:
Toggle via console:
Production Builds
DevTools are automatically excluded in production:
The ReactQueryDevtools component checks process.env.NODE_ENV !== 'development' and returns null in production.
Custom Error Types
Define custom error initializers for testing:
Click “Trigger Error” in DevTools and select an error type to test error handling.
Keyboard Shortcuts
When DevTools are open:
Escape - Close DevTools panel
Ctrl/Cmd + K - Focus search/filter
Ctrl/Cmd + R - Refetch all queries
Filtering Queries
Filter queries in DevTools:
Custom Position
Custom Nonce (CSP)
If you use Content Security Policy:
Shadow DOM
Mount DevTools in Shadow DOM for style isolation:
Next.js
Remix
Electron
Debugging Tips
1. Monitor Query Lifecycle
Watch queries transition through states:
pending → success
- Query becomes
stale after staleTime
- Background refetch when query is
stale and mounted
2. Inspect Data Freshness
Check timestamps:
dataUpdatedAt - When data was last updated
errorUpdatedAt - When error occurred
- Time since last fetch
3. Debug Infinite Queries
Inspect pages structure:
- View
pages array
- Check
pageParams values
- Verify
hasNextPage / hasPreviousPage
4. Examine Cache State
See all cached queries:
- Active queries (mounted)
- Inactive queries (unmounted but cached)
- Stale queries needing refetch
5. Test Error Scenarios
Use error types to simulate failures:
- Network errors
- API errors
- Validation errors
Programmatically control DevTools:
Common Issues
Check that:
- You’re in development mode (
NODE_ENV !== 'production')
- DevTools are inside
QueryClientProvider
- Component is actually rendering (check React DevTools)
DevTools are designed to be lightweight but:
- Automatically disabled in production
- Lazy load if needed
- Use panel mode for better performance
Styling Conflicts
If DevTools styles conflict with your app:
- Use
shadowDOMTarget for isolation
- Adjust
position and buttonPosition
- Use embedded panel mode instead
Next Steps