Prevent double execution of fetchMore

This commit is contained in:
Chi Vinh Le
2017-06-21 01:29:10 +07:00
parent 49420e152e
commit fc14e9d2fd
4 changed files with 51 additions and 14 deletions
@@ -8,6 +8,7 @@ import LoadMore from './LoadMore';
import t from 'coral-framework/services/i18n';
class ModerationQueue extends React.Component {
isLoadingMore = false;
static propTypes = {
viewUserDetail: PropTypes.func.isRequired,
@@ -22,7 +23,15 @@ class ModerationQueue extends React.Component {
}
loadMore = () => {
this.props.loadMore(this.props.activeTab);
if (!this.isLoadingMore) {
this.isLoadingMore = true;
this.props.loadMore(this.props.activeTab)
.then(() => this.isLoadingMore = false)
.catch((e) => {
this.isLoadingMore = false;
throw e;
});
}
}
componentDidUpdate (prev) {