Skip to content

chore(runway): cherry-pick fix: handle Perps withdraw batch initialization errors cp-7.78.0#30469

Merged
chloeYue merged 1 commit into
release/7.78.0from
runway-cherry-pick-7.78.0-1779295562
May 20, 2026
Merged

chore(runway): cherry-pick fix: handle Perps withdraw batch initialization errors cp-7.78.0#30469
chloeYue merged 1 commit into
release/7.78.0from
runway-cherry-pick-7.78.0-1779295562

Conversation

@runway-github

@runway-github runway-github Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a Perps Withdraw loading state where users could get stuck on the
confirmation skeleton if transaction batch initialization failed before
an approval request was created.

The withdraw flow intentionally navigates to Confirmations early and
shows a skeleton loader while the transaction batch is created. This PR
adds the same failure escape hatch used by similar mobile flows: if
addTransactionBatch fails, the app navigates back from the
confirmation loader and shows the existing withdrawal failed toast.

Changelog

CHANGELOG entry: Fixed a bug that caused Perps Withdraw to stay stuck on
a loading screen when withdrawal initialization failed

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1392

Manual testing steps

Feature: Perps Withdraw error handling

  Scenario: user sees an error instead of a stuck loading screen
    Given the user is on the Perps home screen
    And Perps withdraw to any token is enabled
    And withdrawal transaction batch initialization fails

    When user taps Withdraw
    Then the confirmation skeleton is dismissed
    And the user is returned to the previous Perps screen
    And a withdrawal failed toast is shown

Screenshots/Recordings

Before

Users could remain stuck on the confirmation skeleton loader.

After

The app navigates back and shows the withdrawal failed toast.

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production
    performance metrics

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the
    app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described
    in the ticket it closes and includes the necessary testing evidence such
    as recordings and or screenshots.

Note

Medium Risk
Changes Perps withdraw confirmation flow to handle
addTransactionBatch failures by navigating back and showing a retry
action, which affects user navigation and error handling paths. Risk is
moderate due to potential edge cases around retry loops and
toast/navigation state.

Overview
Prevents Perps withdraw from getting stuck on the confirmation
skeleton by catching addTransactionBatch failures in
usePerpsWithdrawConfirmation, navigating back, and showing a new
retryable withdrawalStartFailed toast that re-attempts
initialization.

Adds the withdrawalStartFailed(onRetry) toast option (styled as an
error with a "Try again" link) plus new i18n strings, and
updates/extends unit tests and mocks to cover the failure + retry
behavior and error normalization.

Reviewed by Cursor Bugbot for commit
a7ae72a. Bugbot is set up for automated
code reviews on this repo. Configure
here.


Signed-off-by: dan437 80175477+dan437@users.noreply.github.com b5b803d

…ation errors (#30299)

## **Description**

Fixes a Perps Withdraw loading state where users could get stuck on the
confirmation skeleton if transaction batch initialization failed before
an approval request was created.

The withdraw flow intentionally navigates to Confirmations early and
shows a skeleton loader while the transaction batch is created. This PR
adds the same failure escape hatch used by similar mobile flows: if
`addTransactionBatch` fails, the app navigates back from the
confirmation loader and shows the existing withdrawal failed toast.

## **Changelog**

CHANGELOG entry: Fixed a bug that caused Perps Withdraw to stay stuck on
a loading screen when withdrawal initialization failed

## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1392

## **Manual testing steps**

```gherkin
Feature: Perps Withdraw error handling

  Scenario: user sees an error instead of a stuck loading screen
    Given the user is on the Perps home screen
    And Perps withdraw to any token is enabled
    And withdrawal transaction batch initialization fails

    When user taps Withdraw
    Then the confirmation skeleton is dismissed
    And the user is returned to the previous Perps screen
    And a withdrawal failed toast is shown
```

## **Screenshots/Recordings**

### **Before**

Users could remain stuck on the confirmation skeleton loader.

### **After**

The app navigates back and shows the withdrawal failed toast.

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [ ] I've tested on Android
- [ ] I've tested with a power user scenario
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Perps withdraw confirmation flow to handle
`addTransactionBatch` failures by navigating back and showing a retry
action, which affects user navigation and error handling paths. Risk is
moderate due to potential edge cases around retry loops and
toast/navigation state.
> 
> **Overview**
> Prevents Perps withdraw from getting stuck on the confirmation
skeleton by catching `addTransactionBatch` failures in
`usePerpsWithdrawConfirmation`, navigating back, and showing a new
**retryable** `withdrawalStartFailed` toast that re-attempts
initialization.
> 
> Adds the `withdrawalStartFailed(onRetry)` toast option (styled as an
error with a "Try again" link) plus new i18n strings, and
updates/extends unit tests and mocks to cover the failure + retry
behavior and error normalization.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a7ae72a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
@runway-github runway-github Bot requested review from a team as code owners May 20, 2026 16:46
@metamaskbotv2 metamaskbotv2 Bot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label May 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - PR targets a release branch (release/*)

All E2E tests pre-selected.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@chloeYue chloeYue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sonarqubecloud

Copy link
Copy Markdown

@chloeYue chloeYue merged commit 84e6991 into release/7.78.0 May 20, 2026
295 of 299 checks passed
@chloeYue chloeYue deleted the runway-cherry-pick-7.78.0-1779295562 branch May 20, 2026 19:55
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-M team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants