mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 15:42:27 -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)
|
if (!props)
|
||||||
return {
|
return {
|
||||||
LastGoodAmount: "0",
|
LastGoodAmount: "0",
|
||||||
Amount: "0"
|
Amount: "0",
|
||||||
|
initialized: false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we can edit this without screwing up other copies of it
|
// Ensure we can edit this without screwing up other copies of it
|
||||||
@ -129,7 +130,8 @@ class AmountInput extends React.Component {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
LastGoodAmount: a,
|
LastGoodAmount: a,
|
||||||
Amount: a
|
Amount: a,
|
||||||
|
initialized: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -138,7 +140,8 @@ class AmountInput extends React.Component {
|
|||||||
this.state = this.getInitialState();
|
this.state = this.getInitialState();
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
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.value.eq(this.getValue())) ||
|
||||||
nextProps.security !== this.props.security) {
|
nextProps.security !== this.props.security) {
|
||||||
this.setState(this.getInitialState(nextProps));
|
this.setState(this.getInitialState(nextProps));
|
||||||
|
Loading…
Reference in New Issue
Block a user