diff --git a/src/public/js/components/list/posters.js b/src/public/js/components/list/posters.js index cabd1a0..c273354 100644 --- a/src/public/js/components/list/posters.js +++ b/src/public/js/components/list/posters.js @@ -15,11 +15,8 @@ const DEFAULT_ADD_EXTRA_ITEMS = 30; export default class ListPosters extends React.Component { constructor(props) { super(props); - this.state = { - items: 0, - hasMore: false, - }; this.loadMore = this.loadMore.bind(this); + this.state = this.getNextState(props); } loadMore() { // Nothing to do if the app is loading @@ -35,7 +32,7 @@ export default class ListPosters extends React.Component { } getNextState(props) { let totalListSize = props.data.length; - let currentListSize = this.state.items; + let currentListSize = (this.state && this.state.items) ? this.state.items : 0; let nextListSize = currentListSize + DEFAULT_ADD_EXTRA_ITEMS; let hasMore = true;