Wave your hands in the air and shout hooray because Solid Query comes with dedicated devtools! 🥳
When you begin your Solid Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of Solid Query and will likely save you hours of debugging if you find yourself in a pinch!
For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
The devtools are a separate package that you need to install:
npm i @tanstack/solid-query-devtoolsor
pnpm add @tanstack/solid-query-devtoolsor
yarn add @tanstack/solid-query-devtoolsor
bun add @tanstack/solid-query-devtoolsYou can import the devtools like this:
import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'By default, Solid Query Devtools are only enabled when process.env.NODE_ENV === 'development'. In production, the devtools components render nothing. During development, the server renders an empty container element and the devtools mount into it on the client.
Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
Place the following code as high in your Solid app as you can. The closer it is to the root of the page, the better it will work!
import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
function App() {
return (
<QueryClientProvider client={queryClient}>
{/* The rest of your application */}
<SolidQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
)
}Embedded mode will show the development tools as a fixed element in your application, so you can use our panel in your own development tools.
Place the following code as high in your Solid app as you can. The closer it is to the root of the page, the better it will work!
import { createSignal, Show } from 'solid-js'
import { SolidQueryDevtoolsPanel } from '@tanstack/solid-query-devtools'
function App() {
const [isOpen, setIsOpen] = createSignal(false)
return (
<QueryClientProvider client={queryClient}>
{/* The rest of your application */}
<button
onClick={() => setIsOpen(!isOpen())}
>{`${isOpen() ? 'Close' : 'Open'} the devtools panel`}</button>
<Show when={isOpen()}>
<SolidQueryDevtoolsPanel onClose={() => setIsOpen(false)} />
</Show>
</QueryClientProvider>
)
}The Filter input above the query and mutation lists uses the Key scope by default. Select the scope button inside the input to switch between Key, Data, and All:
The selected scope is remembered across reloads, like the other filter settings.
Select a query or mutation and use Search data in its Data Explorer to search nested property names and primitive values. Search uses case-insensitive text matching and treats special characters as plain text.
Matching text is highlighted. Matching editable values have a highlighted input. The explorer opens matching branches and the first matching page in each paginated collection. Other pages with matches are highlighted so you can open them. You can still inspect other rows and edit query data.
The Data Explorer highlights up to 1,000 matches at a time.
Select Clear or press Escape in the search field to restore your manual expansion. Selecting another query or mutation clears the search, unless the filter scope is Data or All: then the search starts with the filter text. For a mutation, it starts only in the variables or data that match the filter.
Devtools are excluded in production builds. However, it might be desirable to lazy load the devtools in production:
import { createSignal, lazy, onMount, Show, Suspense } from 'solid-js'
import { QueryClient, QueryClientProvider } from '@tanstack/solid-query'
import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
import { Example } from './Example'
const queryClient = new QueryClient()
const SolidQueryDevtoolsProduction = lazy(() =>
import('@tanstack/solid-query-devtools/production').then((d) => ({
default: d.SolidQueryDevtools,
})),
)
function App() {
const [showDevtools, setShowDevtools] = createSignal(false)
onMount(() => {
Object.assign(window, {
toggleDevtools: () => setShowDevtools((old) => !old),
})
})
return (
<QueryClientProvider client={queryClient}>
<Example />
<SolidQueryDevtools initialIsOpen />
<Show when={showDevtools()}>
<Suspense fallback={null}>
<SolidQueryDevtoolsProduction />
</Suspense>
</Show>
</QueryClientProvider>
)
}
export default AppWith this, calling window.toggleDevtools() will download the devtools bundle and show them.
@tanstack/solid-query-devtools/production also exports SolidQueryDevtoolsPanel for Embedded Mode.
For TypeScript, you would need to set moduleResolution to 'bundler', 'node16', or 'nodenext' in your tsconfig.