diff --git a/source/components/CurrencyInput/CurrencyInput.js b/source/components/CurrencyInput/CurrencyInput.js index 36b216a0f..2f0374287 100644 --- a/source/components/CurrencyInput/CurrencyInput.js +++ b/source/components/CurrencyInput/CurrencyInput.js @@ -14,7 +14,7 @@ let isCurrencyPrefixed = language => class CurrencyInput extends Component { state = { - value: this.props.defaultValue + value: this.props.storeValue } onChange = this.props.debounce ? debounce(this.props.debounce, this.props.onChange) @@ -39,6 +39,14 @@ class CurrencyInput extends Component { } this.onChange(event) } + componentDidUpdate(prevProps) { + if ( + prevProps.storeValue !== this.props.storeValue && + this.props.storeValue !== this.state.value + ) { + this.setState({ value: this.props.storeValue }) + } + } render() { let forwardedProps = omit( diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index eaee75f1a..fb34f2960 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -28,7 +28,7 @@ export default compose( withColours, reduxForm({ form: 'conversation', - destroyOnUnmount: false + destroyOnUnmount: true }), connect( state => ({ @@ -212,9 +212,9 @@ const Target = ({ + onFirstClick={value => { setFormValue(target.dottedName, '' + value) - } + }} rulePeriod={target.période} colouredBackground={true} /> @@ -250,7 +250,7 @@ let CurrencyField = withColours(props => { }} debounce={600} className="targetInput" - defaultValue={props.input.value} + storeValue={props.input.value} {...props.input} {...props} />