Skip to content

fix: MUSD-400 fixed spam clicks on bottom sheet component causing it to navigate back #27026

Merged
Matt561 merged 11 commits into
mainfrom
fix/musd-400-quick-convert-buttons-disabled-after-switching-payment-tokens-quickly-on-custom-convert-screen
Mar 9, 2026
Merged

fix: MUSD-400 fixed spam clicks on bottom sheet component causing it to navigate back #27026
Matt561 merged 11 commits into
mainfrom
fix/musd-400-quick-convert-buttons-disabled-after-switching-payment-tokens-quickly-on-custom-convert-screen

Conversation

@Matt561
Copy link
Copy Markdown
Contributor

@Matt561 Matt561 commented Mar 4, 2026

Description

Fixes a bug where rapidly tapping UI elements that open a BottomSheet (e.g. PayWithRow → PayWithModal) could cause an extra navigation.goBack() to fire after the BottomSheet's screen was already popped. For the mUSD conversion flow, this caused the onReject to not be called leaving stale pending approvals and incorrectly disabling the Quick Convert view.

Adds a navigation.isFocused() guard before goBack() in BottomSheet.onCloseCB so that stale close callbacks from Reanimated animations become no-ops when the screen is no longer active.

Changes

  • BottomSheet.tsx: Guard navigation.goBack() with navigation.isFocused() check in onCloseCB

Changelog

CHANGELOG entry: fixed BottomSheet dismissing the wrong screen when rapidly opened and closed, which could leave mUSD conversion confirmation flows in a blocked state with unrejected pending approvals

Related issues

Fixes: MUSD-400: Quick convert buttons disabled after switching payment tokens quickly on custom convert screen

Manual testing steps

Feature: mUSD conversion BottomSheet dismiss does not break Quick Convert view

  Scenario: user spam-taps Pay With on the mUSD custom conversion screen
    Given user is on the mUSD Quick Convert view with convertible stablecoin balances
    And user taps the Edit (pencil) icon on a token row to open the custom conversion screen

    When user rapidly taps the Pay With row and continues tapping as the Pay With modal opens
    Then the Pay With modal closes and the user remains on the custom conversion screen
    And the user is not navigated back to the Quick Convert view
    And the Quick Convert view does not show a loading spinner or disabled action buttons

Screenshots/Recordings

Before

Convert.buttons.freeze.1.mp4

After

Screen_Recording_20260304_170111_MetaMask.mp4

Pre-merge author checklist

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
Touches shared BottomSheet close/back-handling behavior, so regressions could affect navigation dismissal across many screens, though the change is a narrow isFocused() guard.

Overview
Prevents rapid open/close interactions from popping the wrong screen by guarding BottomSheet's onClose and Android hardware back handling with navigation.isFocused() before attempting dismissal.

Updates a broad set of Jest navigation mocks/snapshots to include isFocused() so tests align with the new BottomSheet navigation dependency.

Written by Cursor Bugbot for commit 583f2a0. This will update automatically on new commits. Configure here.

…d and closed, which could leave confirmation flows in a blocked state with unrejected pending approvals
@Matt561 Matt561 requested a review from a team as a code owner March 4, 2026 22:02
@Matt561 Matt561 added No QA Needed Apply this label when your PR does not need any QA effort. team-earn labels Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 2026

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.

@Matt561 Matt561 requested review from a team as code owners March 5, 2026 15:25
@github-actions github-actions Bot added size-S and removed size-XS labels Mar 5, 2026
@Matt561 Matt561 marked this pull request as draft March 5, 2026 15:54
@Matt561 Matt561 force-pushed the fix/musd-400-quick-convert-buttons-disabled-after-switching-payment-tokens-quickly-on-custom-convert-screen branch from 2ff9b53 to a8dacac Compare March 5, 2026 16:36
…after-switching-payment-tokens-quickly-on-custom-convert-screen
@Matt561 Matt561 marked this pull request as ready for review March 5, 2026 16:48
@Matt561 Matt561 requested review from a team as code owners March 5, 2026 18:36
nickewansmith
nickewansmith previously approved these changes Mar 5, 2026
Brunonascdev
Brunonascdev previously approved these changes Mar 5, 2026
hmalik88
hmalik88 previously approved these changes Mar 5, 2026
brianacnguyen
brianacnguyen previously approved these changes Mar 6, 2026
wachunei
wachunei previously approved these changes Mar 6, 2026
…after-switching-payment-tokens-quickly-on-custom-convert-screen
@Matt561 Matt561 enabled auto-merge March 6, 2026 20:32
…after-switching-payment-tokens-quickly-on-custom-convert-screen
@Matt561 Matt561 force-pushed the fix/musd-400-quick-convert-buttons-disabled-after-switching-payment-tokens-quickly-on-custom-convert-screen branch from 536eb51 to 8964038 Compare March 9, 2026 16:58
…after-switching-payment-tokens-quickly-on-custom-convert-screen
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeWalletPlatform, SmokeCard, SmokePerps, SmokeRamps, SmokeMultiChainAPI, SmokePredictions
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: high
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change modifies the shared BottomSheet component used across the app. It introduces navigation.isFocused() guards before calling navigation.goBack() and before handling Android hardware back presses. Since BottomSheet underpins confirmations, network selectors, account selectors, trade flows, ramps, card flows, perps, predictions, multi-chain permission sheets, and various modals, this affects core navigation and dismissal behavior globally.

Potential risks include:

  • Bottom sheets not closing when expected (navigation focus edge cases)
  • Duplicate or skipped navigation events
  • Android back button behavior regressions
  • Broken confirmation or permission flows

Because BottomSheet is a shared foundational UI component, the blast radius is high and spans nearly all major wallet flows. To safely validate navigation and dismissal behavior across critical user journeys, a broad E2E sweep is required.

All dependent tag requirements have been respected:

  • SmokeTrade includes SmokeConfirmations
  • SmokeCard includes SmokeTrade and SmokeConfirmations
  • SmokePerps includes SmokeWalletPlatform and SmokeConfirmations
  • SmokePredictions includes SmokeWalletPlatform and SmokeConfirmations
  • SmokeMultiChainAPI includes SmokeNetworkAbstractions and SmokeNetworkExpansion
  • SmokeNetworkExpansion includes SmokeConfirmations

Performance Test Selection:
The change only adds navigation focus guards and logging inside the BottomSheet component. There are no changes to rendering logic, list performance, controller state management, data fetching, or startup flows. No measurable performance impact is expected.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

E2E Fixture Validation — Schema is up to date
9 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 9, 2026

@Matt561 Matt561 added this pull request to the merge queue Mar 9, 2026
Merged via the queue into main with commit c9e0ded Mar 9, 2026
118 checks passed
@Matt561 Matt561 deleted the fix/musd-400-quick-convert-buttons-disabled-after-switching-payment-tokens-quickly-on-custom-convert-screen branch March 9, 2026 19:32
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-S team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants