Merge pull request #542 from betagouv/bug-focus-mac

🐛 répare les suggestions
pull/543/head
Johan Girod 2019-05-17 17:47:39 +02:00 committed by GitHub
commit 2374879234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -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(

View File

@ -28,7 +28,7 @@ export default compose(
withColours,
reduxForm({
form: 'conversation',
destroyOnUnmount: false
destroyOnUnmount: true
}),
connect(
state => ({
@ -212,9 +212,9 @@ const Target = ({
<Animate.fromTop>
<InputSuggestions
suggestions={target.suggestions}
onFirstClick={value =>
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}
/>