From 066e5ff141318f52250830288deef3a7ec83aa60 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Thu, 18 Oct 2018 11:42:10 -0400 Subject: [PATCH] Use top level + replies count to control "Load More" comments button This fixes an issue where a project with one top-level comment and one reply would should the "Load more" button at the bottom, even though there were no more to load --- src/views/preview/presentation.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/preview/presentation.jsx b/src/views/preview/presentation.jsx index 65a1db68b..c00334f8b 100644 --- a/src/views/preview/presentation.jsx +++ b/src/views/preview/presentation.jsx @@ -90,6 +90,7 @@ const PreviewPresentation = ({ onUpdate }) => { const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : ''; + const loadedCommentCount = comments.length + Object.keys(replies).reduce((acc, id) => acc + replies[id].length, 0); return (
{!isShared && ( @@ -383,7 +384,7 @@ const PreviewPresentation = ({ onRestore={onRestoreComment} /> ))} - {comments.length < projectInfo.stats.comments && + {loadedCommentCount < projectInfo.stats.comments &&