# TanStack Query

> Browse, edit, refetch and invalidate your app's TanStack Query cache from the desktop app. It is off until you pass your QueryClient.

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.

[Setting up TanStack Query in the SDK](/docs/sdk/tanstack-query/)

![The TanStack Query panel in Columns view with a query selected and its data open in the details pane](/_astro/tanstack-query-columns-light.BhSLR0uY_1tW1ou.webp)![The TanStack Query panel in Columns view with a query selected and its data open in the details pane](/_astro/tanstack-query-columns-dark.D3UPJyzb_azDbG.webp)

The TanStack Query panel in Columns view with a query selected and its data open in the details pane

## Using the TanStack Query panel

### Browsing queries

The **Queries** tab opens in **Columns** view. Each part of a query key is a column: select `todos` to see the keys under it, such as `["todos", 1]` and `["todos", 2]`. Keys are sorted alphabetically, and a key with only one entry under it opens that entry for you.

* **All queries** heads the first column.
* **This query** appears at the top of a column when a key is a query itself and also has longer keys under it, such as `["todos"]` alongside `["todos", 1]`.

Switch to **List** to see every query on one row, with its status, key, observer count and when its data last updated.

### Query status

Each query shows one status, the first of these that applies:

| Status       | When                                            |
| ------------ | ----------------------------------------------- |
| **Fetching** | The query is fetching.                          |
| **Error**    | The last fetch failed.                          |
| **Pending**  | The query has no data yet.                      |
| **Stale**    | The data is stale or the query was invalidated. |
| **Fresh**    | Otherwise.                                      |

In Columns view, a key shows the first status that applies to any query under it. A query turns **Stale** on its own once its `staleTime` runs out.

### Filtering

Type in **Filter by key or hash…** to show the queries whose query hash or key contains the text, ignoring case. While a filter is set, the queries are shown as a list. On the **Mutations** tab, **Filter by key or id…** matches a mutation’s key or id.

The number of hidden entries is shown under the toolbar, and **Clear filter** shows them again.

### Inspecting a query

Select a query to open it in the details pane. The **Data** tab shows its cached data, with an **Error** section above it when the last fetch failed.

The **Info** tab shows its **Status**, **Fetch status** (**Fetching**, **Paused** or **Idle**), **Observers**, **Data updated**, **Error updated**, **Invalidated** and **Stale at**.

**Stale at** is when the data goes stale: when it was last updated plus the shortest `staleTime` of the query’s enabled observers. It reads **Now** once that has passed or the query is invalidated, and **Never** when nothing will make it stale, such as when the query has no observers or its `staleTime` is `Infinity` or `'static'`.

### Editing data

Changes are made with `setQueryData`, so the components using the query update straight away.

* **A value:** double-click a string, number, boolean or `null`, type the new value and press `Enter`. `Escape` cancels. A string is saved as typed. Any other value must be a JSON string, number, boolean or `null`, such as `42`, `true` or `"42"`.
* **Array items:** hover over an array or one of its items. **Add item** adds an item at the start of the array, and **Add item after…** adds one after that item. Choose **String**, **Number**, **Boolean** or **Null**, then type its value. **Remove item** removes it.
* **The whole value:** click **Overwrite data** to edit the data as JSON, then click **Save**. It’s unavailable when the data holds a value with no JSON form, such as a `Date` or a function.

### Refetching and invalidating

Click **Refetch** or **Invalidate** in the details pane to act on that query. **Invalidate** marks the query as stale and refetches it if it’s in use.

To act on many queries at once, click **More actions** on a key in Columns view, or on **All queries**, and choose **Refetch** or **Invalidate**. They act on every query under that key, and show how many that is. The confirmation appears straight away, without waiting for the fetches to finish.

### Removing a query

Click **Remove query** in the details pane, then **Remove**, to remove the query from the cache.

### Mutations

![The Mutations tab with a POST mutation selected and its variables in the details pane](/_astro/tanstack-query-mutations-light.C0HMbDML_Z1Rr2Yj.webp)![The Mutations tab with a POST mutation selected and its variables in the details pane](/_astro/tanstack-query-mutations-dark.dIbn-l8j_1FoNrd.webp)

The Mutations tab with a POST mutation selected and its variables in the details pane

The **Mutations** tab lists each mutation with its status (**Idle**, **Pending**, **Success** or **Error**), its `mutationKey`, or its id when it has no key, and when it was submitted. Select one to see its **Variables**, and its **Error** if it failed.

## Limits and Troubleshooting

* Mutations are read-only, and their result isn’t shown.
* Values and array items edited one at a time are strings, numbers, booleans or `null`. To add an object or array, use **Overwrite data**.
