Skip to content

fix: perps leverage glitch#28960

Merged
tommasini merged 23 commits into
mainfrom
fix/perps-leverage-glitch
Apr 17, 2026
Merged

fix: perps leverage glitch#28960
tommasini merged 23 commits into
mainfrom
fix/perps-leverage-glitch

Conversation

@tommasini

@tommasini tommasini commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fix perps glitch when pressing leverage.

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Low Risk
Low risk UI-state change confined to the leverage bottom sheet’s visibility effect; main risk is behavioral regression in how/when the sheet opens.

Overview
Prevents the Perps leverage bottom sheet from imperatively calling bottomSheetRef.current?.onOpenBottomSheet() when isVisible becomes true.

The visibility effect now only runs the reset-to-initial logic when the sheet closes (!isVisible), avoiding the open/reset sequencing that caused the leverage-press glitch.

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

@tommasini tommasini requested review from a team as code owners April 17, 2026 02:45
@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.

@metamaskbotv2 metamaskbotv2 Bot added the team-mobile-platform Mobile Platform team label Apr 17, 2026
@tommasini tommasini changed the base branch from main to fix/perps-home-transition April 17, 2026 02:46
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 17, 2026
Base automatically changed from fix/perps-home-transition to main April 17, 2026 08:49
@michalconsensys

Copy link
Copy Markdown
Contributor

Hello @tommasini what is the purpose of this PR? Is it to fix the leverage bottomsheet only? Why is there a change to android/app/build.gradle, app/components/UI/Perps/routes/index.tsx, ios/MetaMask.xcodeproj/project.pbxproj, and bitrise.yml?

@github-actions github-actions Bot added size-XS risk-low Low testing needed · Low bug introduction risk and removed size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePreps
  • Risk Level: low
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change is a focused bug fix in PerpsLeverageBottomSheet.tsx. It removes the explicit bottomSheetRef.current?.onOpenBottomSheet() call when isVisible is true, and keeps only the state reset logic when !isVisible. This is a small, isolated change within the Perps feature.

Direct impact: SmokePerps - the leverage bottom sheet is a core part of the Perps trading flow (used in PerpsOrderView). The change affects how the bottom sheet opens/closes and resets state.

Dependent tags per tag descriptions:

  • SmokeWalletPlatform: Required because Perps is a section inside the Trending tab, and changes to Perps views affect Trending.
  • SmokeConfirmations: Required per SmokePerps description - "When selecting SmokePerps, also select SmokeConfirmations (Add Funds deposits are on-chain transactions)."

The change is low risk as it's isolated to a single component within the Perps feature, but the dependent tags are included per the tag relationship rules.

Performance Test Selection:
The change modifies bottom sheet open/close behavior in the Perps leverage flow. The @PerformancePreps tag covers perps market loading and position management, which includes the leverage bottom sheet interaction. Removing the explicit onOpenBottomSheet() call could affect UI responsiveness timing in the perps flow, making it worth validating with performance tests.

View GitHub Actions results

@tommasini

Copy link
Copy Markdown
Contributor Author

@michalconsensys it was branched of the branch of the native stack implementation, then when that branch was merged, github redirects this to merge into main, but do not update the files, we needed to pull from main to that happen. I believe it's a gh bug

@tommasini tommasini enabled auto-merge April 17, 2026 10:42
@tommasini tommasini added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@sonarqubecloud

Copy link
Copy Markdown

@tommasini tommasini added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit dae26e3 Apr 17, 2026
111 of 112 checks passed
@tommasini tommasini deleted the fix/perps-leverage-glitch branch April 17, 2026 11:12
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.75.0 Issue or pull request that will be included in release 7.75.0 label Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.75.0 Issue or pull request that will be included in release 7.75.0 risk-low Low testing needed · Low bug introduction risk size-XS team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants