The devtools are a separate package that you need to install:
npm i @tanstack/svelte-query-devtools
npm i @tanstack/svelte-query-devtools
or
pnpm add @tanstack/svelte-query-devtools
pnpm add @tanstack/svelte-query-devtools
or
yarn add @tanstack/svelte-query-devtools
yarn add @tanstack/svelte-query-devtools
or
bun add @tanstack/svelte-query-devtools
bun add @tanstack/svelte-query-devtools
You can import the devtools like this:
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
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 Svelte app as you can. The closer it is to the root of the page, the better it will work!
<script>
import { QueryClientProvider } from '@tanstack/svelte-query'
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
</script>
<QueryClientProvider client={queryClient}>
{/* The rest of your application */}
<SvelteQueryDevtools />
</QueryClientProvider>
<script>
import { QueryClientProvider } from '@tanstack/svelte-query'
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
</script>
<QueryClientProvider client={queryClient}>
{/* The rest of your application */}
<SvelteQueryDevtools />
</QueryClientProvider>