mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-25 23:23:21 -05:00
AmountInput: Actually initialize state
This has been broken since the switch to ES6 classes
This commit is contained in:
parent
a4b99381d3
commit
d03eef3035
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user