Skip to content

Commit

Permalink
InterviewSummary: Refactor public function with arrows
Browse files Browse the repository at this point in the history
In javascript, the `this` needs to be bound to the functions when not
using arrow functions. So we use arrow functions to avoid the binding.
  • Loading branch information
tahini committed Sep 11, 2024
1 parent c1465e2 commit 78f2a99
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,34 @@ class InterviewSummary extends React.Component {
}
}

refreshInterview() {
refreshInterview = () => {
// FIXME was previously this line, but we are not using the interview from the global state, so we may just call the summary change again
this.props.startSetValidateInterview(this.props.interview.uuid, (interview) => {
this.setState({ loaded: true })
});
this.props.handleInterviewSummaryChange(this.props.interview.uuid);
}

resetInterview() {
resetInterview = () => {
this.props.startResetValidateInterview(this.props.interview.uuid, (interview) => {
this.props.handleInterviewSummaryChange(interview.uuid);
});
}

componentDidMount() {
componentDidMount = () => {
this.refreshInterview();

//this.forceUpdate();
}

updateValuesByPath(valuesByPath, e) {
updateValuesByPath = (valuesByPath, e) => {
if (e && e.preventDefault) {
e.preventDefault();
}
this.props.startUpdateInterview(null, valuesByPath);
}

render(){
render = () => {

if (!(this.props.interview && this.state.loaded)) {
surveyHelperNew.devLog('%c rendering empty survey', 'background: rgba(0,0,0,0.1);');
Expand Down

0 comments on commit 78f2a99

Please sign in to comment.