From 7266c58d7161fe8adc80bb434c81599bb8d7248c Mon Sep 17 00:00:00 2001 From: Renard Date: Tue, 17 Sep 2019 01:52:07 -0300 Subject: Fix: keys y offset --- src/Board.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Board.js b/src/Board.js index 55df603..e4ec05a 100644 --- a/src/Board.js +++ b/src/Board.js @@ -56,8 +56,9 @@ class Board extends Component { } fetchMoreThreads() { + console.log("fetching more"); fetch( - `https://bienvenidoainternet.org/cgi/api/list?dir=${this.props.dir}&replies=5&limit=10&offset${this.threadOffset}` + `https://bienvenidoainternet.org/cgi/api/list?dir=${this.props.dir}&replies=5&limit=10&offset=${this.threadOffset}` ) .then(response => { return response.json(); @@ -66,6 +67,7 @@ class Board extends Component { if (resource.state === "success") { if (resource.threads.length > 0) { const moreThreads = this.state.threadList.concat(resource.threads); + this.threadOffset += 10; this.setState({ threadList: moreThreads, loadingMore: false }); } } @@ -122,7 +124,7 @@ class Board extends Component { {currentBoard.name} {threadList.map(thread => ( - +
{thread.subject} @@ -147,7 +149,7 @@ class Board extends Component { post={reply} locked={thread.locked} threadId={thread.id} - key={index} + key={"reply_" + reply.id} currentBoard={currentBoard} /> ))} -- cgit v1.2.1-18-gbd029