# Pop Until

The **Pop Until** action navigates backward through the navigation stack until reaching a specified route. This enables jumping back multiple levels in the navigation hierarchy with a single action, regardless of stack depth.

{% embed url="<https://www.youtube.com/watch?v=0iQoE1a5LZc>" %}

Watch this on Youtube: <https://www.youtube.com/watch?v=0iQoE1a5LZc>

***

#### 📦 Properties

| Property              | Type   | Required | Description                          |
| --------------------- | ------ | -------- | ------------------------------------ |
| `routeNameToPopUntil` | String | ❌        | Route name to pop back to (optional) |

***

**Digia Page Route Format:** When popping back to a Digia Studio page, append `'duiPageRoute-'` prefix to the page slug:

* **Digia Page**: If your page slug is `"user-profile-xCMB7s"`, use `"duiPageRoute-user-profile-xCMB7s"`
* **Normal Routes**: Use the route name as-is without prefix

This prefix is required for Digia Studio pages to ensure proper route resolution in the navigation stack.

***

#### ✅ Common Use Cases

* Returning to home screen or main dashboard from deep navigation
* Implementing "back to main menu" functionality
* Resetting navigation state after complex workflows
* Creating emergency exit paths from nested screens
* Implementing breadcrumb-style navigation

***

#### ⚙️ Default Behavior

By default:

| Behavior               | Description                                        |
| ---------------------- | -------------------------------------------------- |
| **Route Matching**     | Pops until exact route name match is found         |
| **Stack Preservation** | Maintains routes above the target route            |
| **Fallback Behavior**  | If no route name specified, performs single pop    |
| **Error Handling**     | No error if target route not found (stops at root) |

***

#### 🛠️ How to Use

<figure><img src="/files/AFKzfRgA6AWKDFscr51T" alt="Copy Slugs"><figcaption><p>Copy Slug</p></figcaption></figure>

1. Add the action to a widget event (e.g., home button, cancel workflow)
2. Choose **Pop Until** from the action list
3. Set the `routeNameToPopUntil` to the target route name
4. Leave empty for single-level back navigation

***


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digia.tech/logic-and-interaction/actions/pop-until.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
