> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/refresh-query.md).

# Refresh Query

The Refresh Query interaction refreshes a component's query and updates the data it displays, without reloading the whole flow or page.

## Overview

The Refresh Query Interaction lets you automatically update the information displayed in your Avonni components after launching a flow. Here's why that's powerful:

* **Real-time updates:** Say goodbye to manual refreshes! Your components will display the latest data seamlessly, creating a more responsive and intuitive user experience.
* **Time-saver:** Users no longer have to wait for pages to reload; information updates happen instantly, saving them time and frustration.
* **Smoother workflows:** Create dynamic flows where data changes trigger updates naturally. Everything feels connected and in sync.

{% hint style="warning" %}
**Important Note:** The "Refresh Query" interaction targets components configured with a Query Data Source. If a component relies on a Variable Data Source, this action will not refresh its data.
{% endhint %}

## Configuration

The interaction re-runs the query of the component that triggers it: a Refresh Query on a Data Table header action reloads that table. Three settings control what the component keeps when it reloads.

### **Override Refresh Behavior**

* **Enabled:** The refresh uses the **Preserve Selected Items** and **Stay on Current Page** settings below instead of the component's own default behavior.
* **Disabled (Default):** The component refreshes the way it normally does.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FIu8NIN5UWnjC1Vftw42i%2Fflow-refresh-query-override.png?alt=media" alt="The Refresh Query interaction in the Flow Interactions panel with Override Refresh Behavior turned on, showing Preserve Selected Items and Stay on Current Page" width="320"><figcaption><p>Override Refresh Behavior on: the two settings below it now apply.</p></figcaption></figure>

### **Preserve Selected Items**

Requires **Override Refresh Behavior** to be enabled.

* **Enabled:** The component keeps the items the end user had selected. Only the Data Table, List and Timeline support this.
* **Disabled (Default):** The selection is reset.

### **Stay on Current Page**

Requires **Override Refresh Behavior** to be enabled.

* **Enabled:** The component stays on the page the end user was on.
* **Disabled (Default):** The component returns to the first page.

## Example

### 1. **Refreshing Data Tables:**

* **Scenario:** Admins want to refresh the data displayed on a Data Table without reloading the entire flow.
* **Usage:** An admin can add a header action button to the Data Table. Clicking this button will trigger the Refresh Query Interaction, refreshing the data in the table based on the latest query parameters and providing real-time data without manual flow restarts.

{% embed url="<https://youtu.be/Wa7k5I4dkbQ?si=ATBvxyZsV8MUJZpq>" %}

### 2. **Enhancing User Interactions within Flows:**

* **Scenario:** Admins want to improve the user experience by minimizing disruptions, and manual refresh needs within a flow.
* **Usage:** Utilizing Refresh Query Interactions allows for more seamless user experiences by enabling dynamic data updates and interactions within a flow without requiring full page or flow reloads, enhancing user engagement and productivity.

These use cases illustrate how admins can leverage the Refresh Query Interaction to create more dynamic, synchronized, and user-friendly flows using the Avonni Components.

## Saved JSON example

Interactions are saved as a JSON array in the interaction attribute of the component. This is a "Refresh Query" interaction using the exact key names:

```json
[
  {
    "targetName": "refresh",
    "type": "RefreshQuery"
  }
]
```

* `targetName` is the Target Name of the row or header action that triggers the interaction.
* `type` is the interaction name, `RefreshQuery`.
* The optional key `refreshQueryComponentIds` lists the API names of the components to refresh. When it is empty, the current component is refreshed. To include the current component in the list, use `avcmpbuilder__current-component-id`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/refresh-query.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
