diff --git a/source/components/Simulateur.js b/source/components/Simulateur.js index dcfc48b4e..3485a1cfa 100644 --- a/source/components/Simulateur.js +++ b/source/components/Simulateur.js @@ -30,8 +30,8 @@ import ResultsGrid from 'Components/ResultsGrid' inputInversions: formValueSelector('conversation')(state, 'inversions') }), dispatch => ({ - startConversation: targetNames => - dispatch({ type: START_CONVERSATION, targetNames }), + startConversation: (targetNames, fromScratch=false) => + dispatch({ type: START_CONVERSATION, targetNames, fromScratch }), resetForm: () => dispatch(reset('conversation')), resetFormField: name => dispatch(change('conversation', name, '')) }) @@ -75,8 +75,8 @@ export default class extends Component { } = this.props, reinitalise = () => { ReactPiwik.push(['trackEvent', 'restart', '']) - this.props.resetForm(this.name) - this.props.startConversation(this.targets) + this.props.resetForm() + this.props.startConversation(this.targetNames, true) } return ( diff --git a/source/reducers.js b/source/reducers.js index ed343aceb..339a36ae0 100644 --- a/source/reducers.js +++ b/source/reducers.js @@ -88,11 +88,12 @@ export let reduceSteps = (tracker, flatRules, answerSource) => ( return { ...newState, // when objectives change, reject theme from answered questions - foldedSteps: R.reject(name => targetNames.includes(nameLeaf(name)))( + foldedSteps: action.fromScratch ? [] : R.reject(name => targetNames.includes(nameLeaf(name)))( state.foldedSteps ) } } + if (action.type == STEP_ACTION && action.name == 'fold') { tracker.push([ 'trackEvent',