-
Notifications
You must be signed in to change notification settings - Fork 45
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 error on clicking "Send" on an empty transfer #1037
Conversation
MegaLinter status: ✅ SUCCESS
See errors details in artifact MegaLinter reports on CI Job page |
1df9d9b
to
1f2a7a9
Compare
I am not exactly sure what are expectations here. Do we really don't want to catch an error when a function input is invalid? Why we even trigger a submit event when a form is empty? |
The form has been implemented in such a way that when nothing is entered for the amount, it displays a "0". So it's not an invalid value, but an implicit 0. I asked about it, and a 0 seems to be a valid value. So I came to the conclusion that
That's why I modified the conversion function so that we interpret "" as 0. |
b65158a
to
80574ae
Compare
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.
Looks like onSubmit
needs to be moved from <Button type="submit" label={t('account.sendTransaction.send', 'Send')} onClick={onSubmit}
to <Form onSubmit={onSubmit}
80574ae
to
8767fb1
Compare
OK, but then we have to adjust the fields a little bit, in order to keep the ability to submit the form without touching the amount field. (I guess we want that, since we had a "0" placeholder on the amount field. ) Done that. |
1d0eb1f
to
7fc0b3f
Compare
4df17ea
to
d39050a
Compare
src/app/pages/AccountPage/Features/SendTransaction/__tests__/index.test.tsx
Outdated
Show resolved
Hide resolved
d39050a
to
0e08a31
Compare
src/app/pages/AccountPage/Features/SendTransaction/__tests__/index.test.tsx
Show resolved
Hide resolved
78c48bf
to
bcfe46f
Compare
8ab0310
to
ee04d7f
Compare
Meanwhile, part of this has already been covered by #1070. What remains here:
|
ee04d7f
to
e40519c
Compare
e40519c
to
07aafb6
Compare
Earlier the "0" was in the placeholder, but not in the actual value, and this was causing some problems.
07aafb6
to
dc27f78
Compare
Got approval from Don @donouwens about the UI/UX perspective. Technical review concluded earlier. Merging... |
This avoids the crash on an empty amount.
Fixes #1031