Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
RIVER_CHUNK_SIZE constant
Browse files Browse the repository at this point in the history
  • Loading branch information
RusAlex committed Dec 21, 2016
1 parent dce8f6f commit 2d0e6a1
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/pages/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import { clearRiver } from '../actions/river';

const client = new ApiClient(API_HOST);

export const RIVER_CHUNK_SIZE = 4;

export class List extends React.Component {
static displayName = 'List';

Expand Down Expand Up @@ -106,14 +108,14 @@ export class List extends React.Component {
}

componentWillMount() {
if (this.props.river.size > 4) {
if (this.props.river.size > RIVER_CHUNK_SIZE) {
this.setState({ displayLoadMore: true });
}
}

componentWillReceiveProps(nextProps) {
let displayLoadMore = false;
if (nextProps.river.size > 4) {
if (nextProps.river.size > RIVER_CHUNK_SIZE) {
displayLoadMore = true;
}

Expand Down Expand Up @@ -259,17 +261,19 @@ const selector = createSelector(
state => state.get('schools'),
state => state.get('users'),
state => state.get('ui'),
(current_user, comments, create_post_form, following, posts, river, schools, users, ui) => ({
comments,
create_post_form,
following,
posts,
river,
schools,
users,
ui,
...current_user
})
(current_user, comments, create_post_form, following, posts, river, schools, users, ui) => {
return {
comments,
create_post_form,
following,
posts,
river,
schools,
users,
ui,
...current_user
};
}
);

export default connect(selector, dispatch => ({
Expand Down

0 comments on commit 2d0e6a1

Please sign in to comment.