From d03eef303581e91a31f8c299cda9cd266695a8f8 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Sun, 11 Jun 2017 06:44:59 -0400 Subject: [PATCH] AmountInput: Actually initialize state This has been broken since the switch to ES6 classes --- js/components/AccountRegister.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/components/AccountRegister.js b/js/components/AccountRegister.js index 51d21d6..0379a7a 100644 --- a/js/components/AccountRegister.js +++ b/js/components/AccountRegister.js @@ -117,7 +117,8 @@ class AmountInput extends React.Component { if (!props) return { LastGoodAmount: "0", - Amount: "0" + Amount: "0", + initialized: false } // Ensure we can edit this without screwing up other copies of it @@ -129,7 +130,8 @@ class AmountInput extends React.Component { return { LastGoodAmount: a, - Amount: a + Amount: a, + initialized: true }; } constructor() { @@ -138,7 +140,8 @@ class AmountInput extends React.Component { this.state = this.getInitialState(); } componentWillReceiveProps(nextProps) { - if ((!nextProps.value.eq(this.props.value) && + if (!this.state.initialized || + (!nextProps.value.eq(this.props.value) && !nextProps.value.eq(this.getValue())) || nextProps.security !== this.props.security) { this.setState(this.getInitialState(nextProps));