File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ const BaseContainer = (props) => {
1717
1818 // pinned and all, they may contain duplicated posts
1919 // i.e., in the most recent 10 posts, one of them may be sticky/pinned posts
20- const pinnedPosts = posts . pinned ;
21- const regularPosts = posts . all . filter ( ( post ) => ! post . sticky ) ;
20+ const pinnedPosts = posts . filter ( ( post ) => post . sticky ) ;
21+ const regularPosts = posts . filter ( ( post ) => ! post . sticky ) ;
2222 const sortedPosts = [ ...pinnedPosts , ...regularPosts ] ;
2323
2424 return (
@@ -66,7 +66,7 @@ const BaseContainer = (props) => {
6666} ;
6767
6868BaseContainer . propTypes = {
69- posts : PropTypes . object . isRequired ,
69+ posts : PropTypes . array . isRequired ,
7070 tags : PropTypes . object . isRequired ,
7171} ;
7272
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ const PostsContainer = ({ isLoading }) => {
1717 return < NoPostMessage msg = "The author hasn't published any posts!" /> ;
1818 }
1919
20- return < BaseContainer posts = { { all, pinned } } tags = { tags } /> ;
20+ const posts = [ ...all , ...pinned ] ;
21+ const postsWithoutDuplicates = Array . from ( new Set ( posts ) ) ;
22+
23+ return < BaseContainer posts = { postsWithoutDuplicates } tags = { tags } /> ;
2124} ;
2225
2326PostsContainer . propTypes = {
You can’t perform that action at this time.
0 commit comments