Skip to content

fix: improve UX around gas estimation failing#25955

Merged
jpuri merged 5 commits intomainfrom
estimate_failure_improvements
Feb 13, 2026
Merged

fix: improve UX around gas estimation failing#25955
jpuri merged 5 commits intomainfrom
estimate_failure_improvements

Conversation

@jpuri
Copy link
Contributor

@jpuri jpuri commented Feb 11, 2026

Description

Improve handling of scenario when gas estimation fails.

Changelog

CHANGELOG entry:

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6389

Manual testing steps

  1. Mock gas estimations to fail and submit a transaction
  2. Check that Unavailable is displayed for gas
  3. Update to custom value and see that alert and unavailable goes away

Screenshots/Recordings

Screen.Recording.2026-02-10.at.8.12.20.PM.mov

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

Low Risk
UI/UX and hook refactor around gas-estimation failure handling; limited scope with added test coverage, but touches core confirmation fee display logic.

Overview
Improves confirmation UX when gas estimation fails by introducing a shared useEstimationFailed hook (based on simulationFails, but ignored for UserFeeLevel.CUSTOM) and wiring it into the confirmations flow.

When estimation is failed, the gas fee token selector is disabled (no arrow, modal won’t open) and the gas fee display shows "Unavailable" (new transactions.unavailable i18n string), while still showing Paid by MetaMask for sponsored fees. Tests were updated/added to cover these behaviors and the updated alert suppression for custom fee level.

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

@jpuri jpuri requested a review from a team as a code owner February 11, 2026 13:14
@jpuri jpuri added team-confirmations Push issues to confirmations team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Feb 11, 2026
@github-actions
Copy link
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.

@jpuri jpuri marked this pull request as draft February 11, 2026 15:02
@jpuri jpuri marked this pull request as ready for review February 11, 2026 16:02
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the transaction confirmation UI, specifically handling gas estimation failures:

  1. New useEstimationFailed hook: A new hook that determines if gas estimation has failed (simulationFails is truthy AND userFeeLevel is not CUSTOM). This is used to improve UX when gas estimation fails.

  2. selected-gas-fee-token.tsx: Now disables gas fee token selection when estimation has failed, preventing users from selecting gas fee tokens when gas cannot be accurately estimated.

  3. gas-fee-details-row.tsx: Now shows "Unavailable" text when estimation has failed instead of potentially incorrect display values.

  4. useGasEstimateFailedAlert.ts: Refactored to use the new centralized hook instead of directly checking simulationFails.

  5. locales/languages/en.json: Added "Unavailable" translation string for the transactions section.

The gas-fee-details-row component is used across multiple confirmation types (staking, transaction batch, approve, contract deployment, contract interaction, switch account type, transfer), all of which are covered by SmokeConfirmations.

The changes are defensive improvements to error handling in the confirmation flow - they don't add new features but improve how the app handles edge cases when gas estimation fails. The risk is medium because while the changes are well-scoped with good unit test coverage, they affect a critical user flow (transaction confirmations) and could potentially impact the user's ability to complete transactions if there are any issues.

Performance Test Selection:
The changes are focused on conditional UI rendering based on gas estimation failure state. They don't introduce new data loading, complex computations, list rendering, or changes to app startup/initialization. The changes are simple boolean checks that conditionally show 'Unavailable' text or disable gas fee token selection. No performance impact is expected from these changes.

View GitHub Actions results

@sonarqubecloud
Copy link

@jpuri jpuri added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit ad7f966 Feb 13, 2026
92 checks passed
@jpuri jpuri deleted the estimate_failure_improvements branch February 13, 2026 10:05
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 13, 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.67.0 Issue or pull request that will be included in release 7.67.0 size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants