diff --git a/packages/concordia-app/src/components/PostList/index.jsx b/packages/concordia-app/src/components/PostList/index.jsx index c42a8c6..05c06de 100644 --- a/packages/concordia-app/src/components/PostList/index.jsx +++ b/packages/concordia-app/src/components/PostList/index.jsx @@ -8,7 +8,7 @@ import { import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames'; import { drizzle } from '../../redux/store'; import PostListRow from './PostListRow'; -import PaginationComponent from '../PaginationComponent'; +import PaginationComponent, { ITEMS_PER_PAGE } from '../PaginationComponent'; const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { cacheCall: getPostChainData } } } } } = drizzle; @@ -16,6 +16,7 @@ const PostList = (props) => { const { postIds, numberOfItems, onPageChange, loading, focusOnPost, } = props; + const [pageNumber, setPageNumber] = useState(1); const [getPostCallHashes, setGetPostCallHashes] = useState([]); useEffect(() => { @@ -40,7 +41,7 @@ const PostList = (props) => { return ( { /> ); }); - }, [focusOnPost, getPostCallHashes, loading, postIds]); + }, [focusOnPost, getPostCallHashes, loading, pageNumber, postIds]); + + const handlePageChange = (event, data) => { + setPageNumber(data.activePage); + onPageChange(event, data); + }; return ( <> @@ -56,7 +62,7 @@ const PostList = (props) => { {posts} - + ); };