TanStack Query
The TanStack Query panel lists the queries and mutations in your app’s QueryClient and keeps them
up to date as your app fetches. You can edit a query’s cached data, and refetch, invalidate or
remove queries from the desktop app.
Using TanStack Query in the desktop app
Accepts
false | QueryClientLike Opt-inPass your QueryClient itself as tanstackQuery, not an object wrapping it:
import { QueryClient } from '@tanstack/query-core';import { init } from '@xerlock/client';
const queryClient = new QueryClient();
init({ tanstackQuery: queryClient });Shapes
Section titled “Shapes”The SDK doesn’t depend on TanStack Query. Any object with this shape works:
| Member | Description |
|---|---|
getQueryCache(): QueryCacheLike | The cache of queries. The SDK reads and subscribes to it to report queries. |
getMutationCache(): MutationCacheLike | The cache of mutations. The SDK reads and subscribes to it to report mutations. |
setQueryData(queryKey: readonly unknown[], data: unknown): unknown | Overwrites the cached data for a query. Used by the desktop app's edit action. |
refetchQueries(filters?: QueryFilterLike): Promise<void> | Refetches queries matching filters, or every query when omitted. |
invalidateQueries(filters?: QueryFilterLike): Promise<void> | Marks queries matching filters as stale and refetches active ones, or every query when omitted. |
Turning it off
Section titled “Turning it off”Leave out tanstackQuery, or pass false, to hide the TanStack Query panel for this app.
Limits and Troubleshooting
Section titled “Limits and Troubleshooting”- The TanStack Query panel is missing: pass your
QueryClientastanstackQueryininit().