From 42f14c8d21027861695fb0c099ce6221dcfb7e46 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Sat, 27 Feb 2021 21:43:43 +0200 Subject: [PATCH] fix: fixed order of posts display --- .../src/views/Topic/TopicView/TopicPostList/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx b/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx index 1b5a771..7d26870 100644 --- a/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx +++ b/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx @@ -41,8 +41,8 @@ const TopicPostList = (props) => { useEffect(() => { if (topicPostCount !== null && topicPostCount !== 0) { - const startIndex = Math.max(topicPostCount - ITEMS_PER_PAGE * pageNumber, 0); - const endIndex = topicPostCount - ITEMS_PER_PAGE * (pageNumber - 1) - 1; + const startIndex = ITEMS_PER_PAGE * (pageNumber - 1); + const endIndex = Math.min(ITEMS_PER_PAGE * pageNumber - 1, topicPostCount - 1); setGetTopicPostsCallHash(getTopicPostsChainData(topicId, startIndex, endIndex)); } }, [pageNumber, topicId, topicPostCount]); @@ -55,7 +55,7 @@ const TopicPostList = (props) => { useEffect(() => { if (getTopicPostsResult) { - setPostIds(getTopicPostsResult.value.slice().reverse().map(Number)); + setPostIds(getTopicPostsResult.value.slice().map(Number)); } }, [getTopicPostsResult, topicPostCount]);