fix: checks tip input re:#1889 #1947
No reviewers
Labels
No labels
accessibility
app-parity
area: creator
area: daemon
area: design
area: devops
area: discovery
area: docs
area: installer
area: internal
area: livestream
area: performance
area: proposal
area: reposts
area: rewards
area: search
area: security
area: subscriptions
area: sync
area: ux
area: viewer
area: wallet
BEAMER
channel
comments
community PR
consider soon
core team
css
dependencies
electron
Epic
feature request
first-timers-only
good first issue
hacktoberfest
help wanted
hub-dependent
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
merge when green
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
notifications
odysee
on hold
playlists
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
recsys
redesign
regression
resilience
sdk dependent
Tom's Wishlist
trending
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry-desktop#1947
Loading…
Reference in a new issue
No description provided.
Delete branch "fixTipModal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue #1889 mentions the tip input allowing any number of decimal places, far beyond one satoshi.
This should do it. I'm looking for input on the Error message, though.
I also noticed that the field would fail to complain about 5.5.5.5 as an input. That's a bit better now, though not perfect. 5.5. slips by for some reason, but 5.5.5 throws an error.
@ -50,6 +50,9 @@ class WalletSendTip extends React.PureComponent<Props, State> {
const { balance } = this.props;
const tipAmount = parseFloat(event.target.value);
let newTipError;
if (!String(tipAmount).match(/^(\d*([.]\d{0,8})?)$/)) {
I think it would be simpler to just do
I appreciate your patience. I agree - it's pretty ugly to cast to string just to use regex.
I was trying to kill all possible birds, but I may be bikeshedding and overthinking it.
Is there any concern about other invalid inputs, or are those handled on the backend? My console.log tests show other invalid tipAmounts like 2.123456789 (9 decimal places) and 'undefined' (from 5.5.5) being passed as the tipAmount state.