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: trim/remove leading zeros from values #2284

Merged
merged 2 commits into from
Jul 14, 2023
Merged

fix: trim/remove leading zeros from values #2284

merged 2 commits into from
Jul 14, 2023

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Jul 13, 2023

What it solves

Resolves #2281

How this PR fixes it

The value of the NumberField component now trims and removes leading zeros.

How to test it

The aforementioned component is used in:

  • Token amount field
  • safeTxGas field
  • Transaction filter: amount, nonce fields
  • Advanced params: wallet nonce, max prio fee, max fee/gas price fields
  • Approval editor: value field
  • Transaction nonce field

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@iamacook iamacook self-assigned this Jul 13, 2023
@github-actions
Copy link

github-actions bot commented Jul 13, 2023

Branch preview

✅ Deploy successful!

https://trim_token_amount--walletweb.review-wallet-web.5afe.dev

@github-actions
Copy link

github-actions bot commented Jul 13, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Comment on lines 70 to 73
onChange: (event) => {
event.target.value = event.target.value.trim()
return event
},
Copy link
Member

Choose a reason for hiding this comment

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

As an additional thing, should we also remove leading zeroes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea! I've added the logic to the NumberField directly.

@iamacook iamacook changed the title fix: trim token amount value fix: trim/remove leading zeros from values Jul 13, 2023
@francovenica
Copy link
Contributor

LGTM

@iamacook iamacook merged commit 5735030 into dev Jul 14, 2023
@iamacook iamacook deleted the trim-token-amount branch July 14, 2023 07:23
@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spending limits - Error show when blank spaces are in the amount input
3 participants