Skip to content

Commit 7824982

Browse files
committed
restore BaseContainer issue
1 parent b9cb95c commit 7824982

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/components/posts/BaseContainer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

6868
BaseContainer.propTypes = {
69-
posts: PropTypes.object.isRequired,
69+
posts: PropTypes.array.isRequired,
7070
tags: PropTypes.object.isRequired,
7171
};
7272

src/components/posts/PostsContainer.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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

2326
PostsContainer.propTypes = {

0 commit comments

Comments
 (0)