Installation
The DevTools are included as an optional peer dependency. Install them separately:The devtools package is listed as an
optionalDependency in Angular Query, so you may see warnings during installation if you skip it. This is normal.Basic Setup
The easiest way to use DevTools is withwithDevtools(), which automatically displays them in development mode:
main.ts
Configuration Options
Customize DevTools behavior by passing options towithDevtools():
main.ts
Available Options
boolean
default:"false"
If
true, the DevTools panel will be open by default when the page loads.'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
default:"'bottom-right'"
Position of the floating DevTools toggle button.
'top' | 'bottom' | 'left' | 'right'
default:"'bottom'"
Side of the screen where the DevTools panel appears.
boolean
default:"isDevMode()"
Controls whether DevTools should load. By default, only loads in development mode.
QueryClient
Optionally specify a different QueryClient. By default, uses the injected QueryClient.
ErrorType[]
Configure error types for error filtering in DevTools.
Reactive Configuration
You can make DevTools options reactive by reading signals or other dependencies:main.ts
Advanced: DevTools Panel
For more control, useinjectDevtoolsPanel to manually render DevTools in your own component:
devtools.component.ts
DevTools Panel Options
ElementRef
required
The DOM element where DevTools will be rendered.
QueryClient
The QueryClient instance to monitor. Defaults to the injected client.
ErrorType[]
Error types for filtering.
string
CSP nonce for inline styles.
ShadowRoot
Render DevTools in a Shadow DOM.
() => void
Callback when DevTools panel is closed.
Using in Your Own DevTools
You can embed TanStack Query DevTools inside your own custom DevTools UI:custom-devtools.component.ts
Forcing Production Build
If you need to load DevTools in production (not recommended), import from the production entry point:main.ts
DevTools Features
Once DevTools are open, you can:Query List
- View all queries with their keys, status, and timestamps
- Filter queries by status (fresh, fetching, stale, inactive)
- Search queries by key
- See query dependencies and relationships
Query Details
Click a query to see:- Data: The current cached data (formatted JSON)
- Query Info: Status, timestamps, fetch count, error count
- Observers: Number of components watching this query
- Actions: Manually refetch, invalidate, or remove the query
Mutation Tracking
- View active and recent mutations
- See mutation status and variables
- Track mutation history
Cache Management
- View total cache size
- See garbage collection status
- Manually clear the entire cache
Troubleshooting
DevTools Not Appearing
DevTools Panel Is Empty
If the DevTools panel opens but shows no queries:- Ensure you’ve created at least one query using
injectQuery - Check that the correct
QueryClientis being used - Try triggering a query manually to see if it appears
Performance Issues
If DevTools slow down your application:- Close DevTools when not actively debugging
- Consider using
injectDevtoolsPanelto render in a separate window - Reduce the number of queries or use query cancellation
Best Practices
-
Use Descriptive Query Keys: Makes it easier to find queries in DevTools
- Monitor Cache Size: Use DevTools to identify queries that cache too much data
- Track Refetch Patterns: Watch for queries that refetch too frequently
- Debug Stale Data: Use DevTools to understand when queries become stale
- Test Error States: Use DevTools actions to trigger refetches and test error handling
Next Steps
Queries Guide
Learn advanced query patterns
Testing
Test your queries effectively
SSR
Server-side rendering with Angular Query
API Reference
Complete DevTools API