-
Notifications
You must be signed in to change notification settings - Fork 100
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(enter amount): switching empty amounts should remain empty #6297
Conversation
@@ -179,7 +179,8 @@ export function useEnterAmount(props: { | |||
.replace(new RegExp(`[${decimalSeparator}]?0+$`), '') | |||
: '' | |||
|
|||
const parsedTokenAmount = parseInputAmount(convertedLocalToToken, decimalSeparator) | |||
const parsedTokenAmount = | |||
amount === '' ? null : parseInputAmount(convertedLocalToToken, decimalSeparator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseInputAmount always returns a big number and returns 0 if the convertedLocalToToken (derived from amount
) is an empty string
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6297 +/- ##
=======================================
Coverage 89.01% 89.01%
=======================================
Files 739 739
Lines 31607 31607
Branches 5879 5877 -2
=======================================
Hits 28134 28134
Misses 3275 3275
Partials 198 198
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Do we need a test to cover for this?
yes! @sviderock did a great job creating thorough test cases so i was able to slot in an assertion in an existing test |
Description
As the title
Test plan
Before: https://valora-app.slack.com/archives/C04B61SJ6DS/p1733247536281249?thread_ts=1733245811.844689&cid=C04B61SJ6DS
After: https://github.com/user-attachments/assets/5108ab1f-73d7-4941-9ad0-17bf338dd302
Related issues
Backwards compatibility
Y
Network scalability
If a new NetworkId and/or Network are added in the future, the changes in this PR will: