# 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="https://3626461507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhApDTL7kHrXte2TTtjs%2Fuploads%2Fgit-blob-a422409c09c90282a0cb3cefee9257cc871c2d8f%2Fpop_until_action.png?alt=media" 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

***
