Merge pull request #1764 from jsit/fix/vote-button-no-spinners-1761
fix: Fix vote buttons not showing spinners while registering vote #1761
This commit is contained in:
commit
083d5aa751
1 changed files with 18 additions and 3 deletions
|
@ -64,8 +64,6 @@ const handleUpvote = (i: VoteButtons) => {
|
||||||
auth: myAuthRequired(),
|
auth: myAuthRequired(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
i.setState({ upvoteLoading: false });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownvote = (i: VoteButtons) => {
|
const handleDownvote = (i: VoteButtons) => {
|
||||||
|
@ -86,7 +84,6 @@ const handleDownvote = (i: VoteButtons) => {
|
||||||
auth: myAuthRequired(),
|
auth: myAuthRequired(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
i.setState({ downvoteLoading: false });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export class VoteButtonsCompact extends Component<
|
export class VoteButtonsCompact extends Component<
|
||||||
|
@ -102,6 +99,15 @@ export class VoteButtonsCompact extends Component<
|
||||||
super(props, context);
|
super(props, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps: VoteButtonsProps) {
|
||||||
|
if (this.props !== nextProps) {
|
||||||
|
this.setState({
|
||||||
|
upvoteLoading: false,
|
||||||
|
downvoteLoading: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -172,6 +178,15 @@ export class VoteButtons extends Component<VoteButtonsProps, VoteButtonsState> {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps: VoteButtonsProps) {
|
||||||
|
if (this.props !== nextProps) {
|
||||||
|
this.setState({
|
||||||
|
upvoteLoading: false,
|
||||||
|
downvoteLoading: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="vote-bar small text-center">
|
<div className="vote-bar small text-center">
|
||||||
|
|
Loading…
Reference in a new issue