From a97fc287e52e2bc50332a4436786658629868ab4 Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Wed, 23 Mar 2022 12:41:30 +0000 Subject: [PATCH] Update comment counts as downloads progress --- src/pages/thread/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/thread/index.js b/src/pages/thread/index.js index 02ec736..c8a3a4e 100644 --- a/src/pages/thread/index.js +++ b/src/pages/thread/index.js @@ -363,11 +363,12 @@ class Thread extends React.Component { } // Check what is removed / deleted according to reddit + let removed = 0, deleted = 0 if (isRemoved(comment.body)) { - this.state.removed++ + removed++ pushshiftComment.removed = true } else if (isDeleted(comment.body)) { - this.state.deleted++ + deleted++ pushshiftComment.deleted = true } else if (pushshiftComment !== comment) { if (isRemoved(pushshiftComment.body)) { @@ -379,6 +380,7 @@ class Thread extends React.Component { pushshiftComment.edited = comment.edited } } + this.setState({ removed: this.state.removed + removed, deleted: this.state.deleted + deleted }) }) return comments.length })