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
This commit is contained in:
Paul Kaplan 2018-10-18 11:42:10 -04:00
parent 505dda09ae
commit 066e5ff141

View file

@ -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 (
<div className="preview">
{!isShared && (
@ -383,7 +384,7 @@ const PreviewPresentation = ({
onRestore={onRestoreComment}
/>
))}
{comments.length < projectInfo.stats.comments &&
{loadedCommentCount < projectInfo.stats.comments &&
<Button
className="button load-more-button"
onClick={onLoadMore}