Skip to content

Commit

Permalink
fix(app): Disable manual ip double submit on enter keypress (#3376)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kadee80 authored Apr 23, 2019
1 parent a79d7ab commit 81291ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/components/AppSettings/AddManualIp/ManualIpForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ class IpForm extends React.Component<Props> {
<Formik
initialValues={{ ip: '' }}
onSubmit={(values, actions) => {
this.props.addManualIp(values.ip)
// trim whitespace and carriage returns
const ip = values.ip.trim()
// guard against double submit on enter keypress
if (!ip) return

this.props.addManualIp(ip)

const $input = this.inputRef.current
if ($input) $input.blur()
Expand Down

0 comments on commit 81291ca

Please sign in to comment.