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

Properly handle decimal point in ETH inputs #2095

Merged
merged 2 commits into from
Mar 12, 2020

Conversation

rdig
Copy link
Member

@rdig rdig commented Mar 10, 2020

Description

This issue arose as just entering a decimal point (no other values), into a ETH input, would then send that value (just the . string) to the EthUsd component which attempted to convert it to USD, which would obviously fail.

Here is a demo of setting a task payout, before making this change:

broken-set-eth-as-decimal

There are just two places we use a token / ETH input:

  • moving tokens between domain pots
  • setting task's payout

Changes

  • TokensMoveDialogForm skip ETH conversion if amount is just .
  • TaskEditDialog skip ETH conversion if payout amount is just .

Demo

demo-proper-move-tokens-eth-decimal

demo-proper-set-eth-decimal-cancel

demo-set-eth-as-decimal-value

Resolves #2009

@rdig rdig requested review from chmanie and ceolson01 March 10, 2020 14:29
@rdig rdig self-assigned this Mar 10, 2020
Copy link
Contributor

@ceolson01 ceolson01 left a comment

Choose a reason for hiding this comment

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

This is a fine solution - as a user, it's what I'd expect to happen when entering .. Also, this mimics the behavior of other financial applications I use.

Nice work, LGTM ✅

@rdig rdig force-pushed the fix/2009-fix-eth-input-decimal-point-value-fetching branch from 2e3a3e3 to 5dc55dd Compare March 12, 2020 13:53
@rdig rdig merged commit 9a5b349 into master Mar 12, 2020
@rdig rdig deleted the fix/2009-fix-eth-input-decimal-point-value-fetching branch March 12, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entering a dot (.) in a number validated input crashes the Dapp
2 participants