Skip to main content
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

DevTools Options

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.

Devtools Panel (Embedded)

Embed DevTools directly in your app UI:

Panel Options

Lazy Loading DevTools

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:

Styling DevTools

Custom Position

Custom Nonce (CSP)

If you use Content Security Policy:

Shadow DOM

Mount DevTools in Shadow DOM for style isolation:

DevTools in Different Environments

Next.js

Remix

Electron

Debugging Tips

1. Monitor Query Lifecycle

Watch queries transition through states:
  • pendingsuccess
  • 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

DevTools API

Programmatically control DevTools:

Common Issues

DevTools Not Showing

Check that:
  1. You’re in development mode (NODE_ENV !== 'production')
  2. DevTools are inside QueryClientProvider
  3. Component is actually rendering (check React DevTools)

Performance Impact

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

  • Testing - Test your queries and mutations
  • Query Keys - Understand query organization