Skip to main content

Solid Query DevTools

The Solid Query DevTools provide a visual interface to inspect, debug, and manage your queries and mutations during development. They’re an essential tool for understanding what’s happening under the hood.

Installation

Install the DevTools package as a dependency:

Basic Usage

Add the SolidQueryDevtools component to your application:
The DevTools component should be placed inside the QueryClientProvider but can be anywhere in your component tree.

Features

The DevTools provide comprehensive visibility into your application’s query state:

Query Explorer

  • View All Queries: See all queries registered with the QueryClient
  • Query Status: Visual indicators for loading, success, error, and stale states
  • Query Details: Inspect query data, error messages, and metadata
  • Cache Time: See when queries were last fetched and when they’ll be garbage collected

Query Actions

  • Refetch: Manually trigger a refetch for any query
  • Invalidate: Invalidate queries to mark them as stale
  • Reset: Reset queries to their initial state
  • Remove: Remove queries from the cache

Mutation Tracking

  • Active Mutations: Monitor mutations in progress
  • Mutation History: Review completed mutations and their results
  • Mutation State: See pending, success, and error states

Configuration Options

Customize the DevTools appearance and behavior:

Available Options

DevTools Panel

For more control, use the SolidQueryDevtoolsPanel component:

Panel Options

The panel component accepts additional configuration:

Production Builds

DevTools are automatically tree-shaken from production builds when using the default import.
The DevTools check isDev from solid-js/web and return null in production:
This ensures DevTools code is never included in production bundles.

Development Only Usage

If you want to ensure DevTools are only available in development:

Debugging Queries

Inspecting Query State

Use the DevTools to inspect detailed query information:
  1. Data Tab: View the current data in the cache
  2. Query Tab: See query configuration and options
  3. Observers Tab: Monitor active observers subscribed to the query
  4. Actions: Perform manual operations on queries

Monitoring Fetch Behavior

Track when queries refetch:

Debugging Cache Behavior

Understand cache timing:
The DevTools show:
  • When data becomes stale
  • When inactive queries are scheduled for garbage collection
  • Active observers keeping queries alive

Mutation Debugging

Track mutation lifecycle:
The DevTools display:
  • Active mutations and their status
  • Mutation variables and results
  • Error messages for failed mutations

Query Cache Exploration

Inspect the entire cache state:

Performance Monitoring

Use DevTools to identify performance issues:

Over-fetching Detection

Identify queries that refetch too frequently:
  1. Open DevTools
  2. Watch the “Last Updated” column
  3. Look for queries updating more often than necessary
  4. Adjust staleTime accordingly

Memory Leaks

Spot queries that aren’t being garbage collected:
  1. Check the “Observers” count
  2. Look for inactive queries with high observer counts
  3. Ensure proper cleanup in components

Unnecessary Renders

Identify components re-rendering due to query updates:

Keyboard Shortcuts

When DevTools are open:
  • Escape: Close DevTools
  • Click Logo: Toggle DevTools panel

Best Practices

Follow these best practices when using DevTools:
  1. Keep DevTools Open: During development, keep DevTools visible to monitor query behavior
  2. Check Query Keys: Verify query keys are correctly structured and unique
  3. Monitor Refetch Behavior: Ensure queries aren’t refetching unnecessarily
  4. Inspect Error States: Use DevTools to debug query and mutation errors
  5. Validate Cache Strategy: Confirm staleTime and gcTime are appropriate
  6. Track Mutations: Monitor mutation success/failure rates

Troubleshooting

DevTools Not Showing

If DevTools don’t appear:
  1. Check Import: Ensure you’re importing from @tanstack/solid-query-devtools
  2. Verify Provider: DevTools must be inside QueryClientProvider
  3. Development Mode: Confirm you’re running in development mode
  4. Position: Check if DevTools are off-screen due to positioning

Performance Impact

DevTools are optimized for minimal performance impact, but they do add overhead. They’re automatically excluded from production builds.

Multiple Query Clients

If using multiple QueryClients:

Custom DevTools Integration

For advanced use cases, access the underlying DevTools API:

Next Steps

Overview

Learn about Solid Query core concepts

TypeScript

Explore TypeScript integration