Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Return to send page with different asset types #28382

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Nov 8, 2024

Description

This bug was reproducible by opening a new wallet initiated send confirmation with a Native token ("simple send") from the extension full screen view, and then triggering a dApp initiated confirmation, and trying to return back to the send flow stepper.

The bug was provoked due to having the editExistingTransaction action dispatched on back button click hardcoded for asset of type token. The fix involves dynamically determining the asset type.

Open in GitHub Codespaces

Related issues

Fixes: #28316

Manual testing steps

See above or check video on the bug report ticket.

Screenshots/Recordings

Before

After

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.

@pedronfigueiredo pedronfigueiredo added the team-confirmations Push issues to confirmations team label Nov 8, 2024
@pedronfigueiredo pedronfigueiredo self-assigned this Nov 8, 2024
Copy link
Contributor

github-actions bot commented Nov 8, 2024

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.

@pedronfigueiredo pedronfigueiredo marked this pull request as ready for review November 8, 2024 15:23
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner November 8, 2024 15:24
@metamaskbot
Copy link
Collaborator

Builds ready [e729514]
Page Load Metrics (1899 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16542352190020096
domContentLoaded16112279186919795
load16532352189920197
domInteractive207947157
backgroundConnect881332412
firstReactRender661641032311
getState45514157
initialActions00000
loadScripts11811719138215976
setupStore66012157
uiStartup179625152117224108
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 430 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

currentConfirmation.type === TransactionType.simpleSend;
const isERC20TokenSend =
currentConfirmation.type === TransactionType.tokenMethodTransfer;
const isNFTTokenSend =
Copy link
Member

@matthewwalsh0 matthewwalsh0 Nov 8, 2024

Choose a reason for hiding this comment

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

Minor, if these booleans only exist to support the if below, would it be cleaner to use a switch:

let assetType: AssetType;

switch(currentConfirmation.type) {
    case TransactionType.simpleSend:
        assetType = AssetType.native;
        break;

    ...

    case TransactionType.tokenMethodTransferFrom:
    case TransactionType.tokenMethodSafeTransferFrom:
        assetType = AssetType.NFT;
        break;

   default:
       assetType = AssetType.unknown;
       break;
}

Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

Will be nice to test cover also, may be in following PR.

@pedronfigueiredo pedronfigueiredo added this pull request to the merge queue Nov 8, 2024
Merged via the queue into develop with commit 4ba7d89 Nov 8, 2024
81 checks passed
@pedronfigueiredo pedronfigueiredo deleted the pnf/28316 branch November 8, 2024 16:45
@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2024
@metamaskbot metamaskbot added the release-12.8.0 Issue or pull request that will be included in release 12.8.0 label Nov 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.8.0 Issue or pull request that will be included in release 12.8.0 team-confirmations Push issues to confirmations team
Projects
None yet
4 participants