Skip to content

Commit

Permalink
Merge branch 'main' into feat/create-post-file-upload-a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
SleeplessOne1917 authored Jul 2, 2023
2 parents d620dea + 083d5aa commit e7f7bc2
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/shared/components/common/vote-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ const handleUpvote = (i: VoteButtons) => {
auth: myAuthRequired(),
});
}

i.setState({ upvoteLoading: false });
};

const handleDownvote = (i: VoteButtons) => {
Expand All @@ -86,7 +84,6 @@ const handleDownvote = (i: VoteButtons) => {
auth: myAuthRequired(),
});
}
i.setState({ downvoteLoading: false });
};

export class VoteButtonsCompact extends Component<
Expand All @@ -102,6 +99,15 @@ export class VoteButtonsCompact extends Component<
super(props, context);
}

componentWillReceiveProps(nextProps: VoteButtonsProps) {
if (this.props !== nextProps) {
this.setState({
upvoteLoading: false,
downvoteLoading: false,
});
}
}

render() {
return (
<>
Expand Down Expand Up @@ -172,6 +178,15 @@ export class VoteButtons extends Component<VoteButtonsProps, VoteButtonsState> {
super(props, context);
}

componentWillReceiveProps(nextProps: VoteButtonsProps) {
if (this.props !== nextProps) {
this.setState({
upvoteLoading: false,
downvoteLoading: false,
});
}
}

render() {
return (
<div className="vote-bar small text-center">
Expand Down

0 comments on commit e7f7bc2

Please sign in to comment.