diff --git a/src/newsreader/js/pages/homepage/components/postlist/PostList.js b/src/newsreader/js/pages/homepage/components/postlist/PostList.js index 168ca8e..136df40 100644 --- a/src/newsreader/js/pages/homepage/components/postlist/PostList.js +++ b/src/newsreader/js/pages/homepage/components/postlist/PostList.js @@ -6,7 +6,6 @@ import { fetchPostsBySection, fetchSavedPosts } from '../../actions/posts.js'; import { SAVED_TYPE } from '../../constants.js'; import { filterPosts } from './filters.js'; -import LoadingIndicator from '../../../../components/LoadingIndicator.js'; import PostItem from './PostItem.js'; class PostList extends React.Component { @@ -56,8 +55,9 @@ class PostList extends React.Component { } render() { + const isLastItem = this.props.postsByType.length - 1 == index; + const postItems = this.props.postsByType.map((item, index) => { - const isLastItem = this.props.postsByType.length - 1 == index; const defaultProps = { key: index, post: item, diff --git a/src/newsreader/js/pages/homepage/reducers/posts.js b/src/newsreader/js/pages/homepage/reducers/posts.js index dd795a0..d422ca7 100644 --- a/src/newsreader/js/pages/homepage/reducers/posts.js +++ b/src/newsreader/js/pages/homepage/reducers/posts.js @@ -1,5 +1,3 @@ -import { isEqual } from 'lodash'; - import { objectsFromArray } from '../../../utils.js'; import { CATEGORY_TYPE, RULE_TYPE } from '../constants.js'; @@ -12,8 +10,6 @@ import { TOGGLING_POST, TOGGLED_POST, } from '../actions/posts.js'; -import { SELECT_CATEGORY } from '../actions/categories.js'; -import { SELECT_RULE } from '../actions/rules.js'; import { MARK_SECTION_READ } from '../actions/selected.js'; const defaultState = { items: {}, isFetching: false, isUpdating: false }; @@ -22,11 +18,13 @@ export const posts = (state = { ...defaultState }, action) => { switch (action.type) { case REQUEST_POSTS: return { ...state, isFetching: true }; + // TODO: save post per category/rule in corresponding reducers case RECEIVE_POST: return { ...state, items: { ...state.items, [action.post.id]: { ...action.post } }, }; + // TODO: save posts per category/rule in corresponding reducers case RECEIVE_POSTS: const receivedItems = objectsFromArray(action.posts, 'id');