From 039d65d818b8f820b20fc8386c811ff47de29e8d Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Fri, 17 May 2019 16:25:27 +0200 Subject: [PATCH 1/3] =?UTF-8?q?:bug:=20r=C3=A9pare=20les=20suggestions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/TargetSelection.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index eaee75f1a..b4c7ec863 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -7,7 +7,7 @@ import withLanguage from 'Components/utils/withLanguage' import withSitePaths from 'Components/utils/withSitePaths' import { encodeRuleName } from 'Engine/rules' import { compose, isEmpty, isNil, propEq } from 'ramda' -import React, { Component, PureComponent } from 'react' +import React, { Component, PureComponent, useState } from 'react' import { withTranslation } from 'react-i18next' import { connect } from 'react-redux' import { Link } from 'react-router-dom' @@ -173,6 +173,7 @@ const Target = ({ }) => { const isSmallTarget = !target.question || !target.formule || isEmpty(target.formule) + const [suggestionValue, setSuggestionValue] = useState(null) return (
  • )} + onFirstClick={value => { setFormValue(target.dottedName, '' + value) - } + setSuggestionValue(value) + }} rulePeriod={target.période} colouredBackground={true} /> From ccb045d161ef07a72e117ae8140a461ceda62ea9 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Fri, 17 May 2019 17:13:20 +0200 Subject: [PATCH 2/3] =?UTF-8?q?:bug:=20r=C3=A9pare=20le=20changement=20de?= =?UTF-8?q?=20p=C3=A9riode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/CurrencyInput/CurrencyInput.js | 10 +++++++++- source/components/TargetSelection.js | 7 ++----- 2 files changed, 11 insertions(+), 6 deletions(-) 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 b4c7ec863..384f21b9e 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -7,7 +7,7 @@ import withLanguage from 'Components/utils/withLanguage' import withSitePaths from 'Components/utils/withSitePaths' import { encodeRuleName } from 'Engine/rules' import { compose, isEmpty, isNil, propEq } from 'ramda' -import React, { Component, PureComponent, useState } from 'react' +import React, { Component, PureComponent } from 'react' import { withTranslation } from 'react-i18next' import { connect } from 'react-redux' import { Link } from 'react-router-dom' @@ -173,7 +173,6 @@ const Target = ({ }) => { const isSmallTarget = !target.question || !target.formule || isEmpty(target.formule) - const [suggestionValue, setSuggestionValue] = useState(null) return (
  • )} { setFormValue(target.dottedName, '' + value) - setSuggestionValue(value) }} rulePeriod={target.période} colouredBackground={true} @@ -253,7 +250,7 @@ let CurrencyField = withColours(props => { }} debounce={600} className="targetInput" - defaultValue={props.input.value} + storeValue={props.input.value} {...props.input} {...props} /> From 1e412f7df5643d913a7e6814189462e0de89ef81 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Fri, 17 May 2019 17:22:28 +0200 Subject: [PATCH 3/3] =?UTF-8?q?:bug:=20r=C3=A9pare=20le=20chargement=20de?= =?UTF-8?q?=20la=20simulation=20sauvegard=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/TargetSelection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 384f21b9e..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 => ({