summaryrefslogtreecommitdiffhomepage
path: root/app/components/AccountInput.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-07-05 16:19:24 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-07-05 16:19:24 +0200
commitf5628a7a1a185e5d71cbeb8d1c3d56bd87ff30b5 (patch)
treeda38bcd09eaca01af7a5b4fd1adf041cf47aa8ef /app/components/AccountInput.js
parente288920bec3000b6cb0da7e16b95c27e4e34be6c (diff)
parent09adf211269ff66eb53af007289765fc53e59b15 (diff)
downloadmullvadvpn-f5628a7a1a185e5d71cbeb8d1c3d56bd87ff30b5.tar.xz
mullvadvpn-f5628a7a1a185e5d71cbeb8d1c3d56bd87ff30b5.zip
Merge branch 'remove-backend'
Diffstat (limited to 'app/components/AccountInput.js')
-rw-r--r--app/components/AccountInput.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/components/AccountInput.js b/app/components/AccountInput.js
index 5a8fa47336..cb7cd258c5 100644
--- a/app/components/AccountInput.js
+++ b/app/components/AccountInput.js
@@ -1,7 +1,7 @@
// @flow
import * as React from 'react';
-import { formatAccount } from '../lib/formatters';
import { TextInput } from 'reactxp';
+import { formatAccount } from '../lib/formatters';
import { colors } from '../config';
// @TODO: move it into types.js
@@ -66,10 +66,13 @@ export default class AccountInput extends React.Component<AccountInputProps, Acc
}
shouldComponentUpdate(nextProps: AccountInputProps, nextState: AccountInputState) {
+ const mergedProps = { ...this.props, ...nextProps };
+ const hasPropChanges = Object.keys(mergedProps).some((key) => {
+ return this.props[key] !== nextProps[key];
+ });
+
return (
- this.props.value !== nextProps.value ||
- this.props.onEnter !== nextProps.onEnter ||
- this.props.onChange !== nextProps.onChange ||
+ hasPropChanges ||
this.state.value !== nextState.value ||
this.state.selectionRange[0] !== nextState.selectionRange[0] ||
this.state.selectionRange[1] !== nextState.selectionRange[1]
@@ -78,8 +81,7 @@ export default class AccountInput extends React.Component<AccountInputProps, Acc
render() {
const displayString = formatAccount(this.state.value || '');
- // eslint-disable-next-line no-unused-vars
- const { value, onChange, onEnter, ...otherProps } = this.props;
+ const { value: _value, onChange: _onChange, onEnter: _onEnter, ...otherProps } = this.props;
return (
<TextInput
{...otherProps}