Skip to content

Commit 4c711c1

Browse files
committed
Feedback from code reviews
1 parent 52eff8b commit 4c711c1

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/components/product-reviews-list/product-reviews-list.jsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import React, { Component, Element } from 'react';
55
import _ from 'lodash';
66
import moment from 'moment';
7+
import { autobind } from 'core-decorators';
78

89
// components
910
import WaitAnimation from 'components/core/wait-animation/wait-animation';
@@ -36,7 +37,7 @@ type Props = {
3637
title: string,
3738
emptyContentTitle: string,
3839
paginationSize: number,
39-
onLoadMoreReviews: Function,
40+
onLoadMoreReviews: (from: number) => Promise<mixed>,
4041
showLoadMore: ?boolean,
4142
};
4243

@@ -83,10 +84,6 @@ const ReviewBody = (props: ReviewBodyProps): Element<any> => {
8384
);
8485
};
8586

86-
function incrementPage(nextPage) {
87-
return { page: nextPage };
88-
}
89-
9087
class ProductReviewsList extends Component {
9188

9289
props: Props;
@@ -150,12 +147,13 @@ class ProductReviewsList extends Component {
150147
);
151148
}
152149

153-
handleLoadMoreReviews = () => {
150+
@autobind
151+
handleLoadMoreReviews() {
154152
const { onLoadMoreReviews, paginationSize } = this.props;
155153
const { page } = this.state;
156154

157155
const nextPage = page + 1;
158-
this.setState(incrementPage(nextPage));
156+
this.setState({page: nextPage});
159157
onLoadMoreReviews(paginationSize * nextPage);
160158
}
161159

0 commit comments

Comments
 (0)