Skip to content

Commit

Permalink
simplify setStates
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Jan 9, 2024
1 parent 459a8ce commit 3fccc2c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/TaskCommentInput/TaskCommentInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export class TaskCommentInput extends Component {

handleSubmit = () => {
if (!this.state.isSubmitActionPerformed) {
this.setState({ isSubmitActionPerformed: true });
this.setState({ showingPreview: false });
this.setState({ isSubmitActionPerformed: true, showingPreview: false });
this.props.submitComment();
}
};
Expand All @@ -40,8 +39,7 @@ export class TaskCommentInput extends Component {
componentDidUpdate(prevProps) {
// Update our character count as needed
if (this.props.value !== prevProps.value) {
this.setState({ characterCount: _get(this.props.value, "length", 0) });
this.setState({ isSubmitActionPerformed: false });
this.setState({ characterCount: _get(this.props.value, "length", 0), isSubmitActionPerformed: false });
}
}

Expand Down

0 comments on commit 3fccc2c

Please sign in to comment.