Merge pull request #2208 from paulkaplan/fix-load-more

Use top level + replies count to control "Load More" comments button
This commit is contained in:
Paul Kaplan 2018-10-18 13:19:10 -04:00 committed by GitHub
commit f3b9826fd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,6 +90,7 @@ const PreviewPresentation = ({
onUpdate onUpdate
}) => { }) => {
const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : ''; 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 ( return (
<div className="preview"> <div className="preview">
{!isShared && ( {!isShared && (
@ -383,7 +384,7 @@ const PreviewPresentation = ({
onRestore={onRestoreComment} onRestore={onRestoreComment}
/> />
))} ))}
{comments.length < projectInfo.stats.comments && {loadedCommentCount < projectInfo.stats.comments &&
<Button <Button
className="button load-more-button" className="button load-more-button"
onClick={onLoadMore} onClick={onLoadMore}