🐛 répare les suggestions

pull/542/head
Johan Girod 2019-05-17 16:25:27 +02:00
parent f9e6d2e834
commit 039d65d818
No known key found for this signature in database
GPG Key ID: 9E27B57DA2E8AE12
1 changed files with 6 additions and 3 deletions

View File

@ -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 (
<li
@ -198,6 +199,7 @@ const Target = ({
/>
)}
<TargetInputOrValue
key={suggestionValue}
{...{
target,
targets,
@ -212,9 +214,10 @@ const Target = ({
<Animate.fromTop>
<InputSuggestions
suggestions={target.suggestions}
onFirstClick={value =>
onFirstClick={value => {
setFormValue(target.dottedName, '' + value)
}
setSuggestionValue(value)
}}
rulePeriod={target.période}
colouredBackground={true}
/>