diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index d9b5c8310..a16852c00 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -79,10 +79,12 @@ class Embed extends Component { if(!isEqual(nextProps.data.asset, this.props.data.asset)) { loadAsset(nextProps.data.asset); - const {getCounts, updateCountCache} = this.props; + const {getCounts, updateCountCache, asset: {countCache}} = this.props; const {asset} = nextProps.data; - updateCountCache(asset.id, asset.commentCount); + if (!countCache) { + updateCountCache(asset.id, asset.commentCount); + } this.setState({ countPoll: setInterval(() => { @@ -127,6 +129,10 @@ class Embed extends Component { const banned = user && user.status === 'BANNED'; + const hasOlderComments = + asset && asset.lastComment && + asset.lastComment.id !== asset.comments[asset.comments.length - 1].id; + const expandForLogin = showSignInDialog ? { minHeight: document.body.scrollHeight + 200 } : {}; @@ -259,7 +265,7 @@ class Embed extends Component { topLevel={true} assetId={asset.id} comments={asset.comments} - moreComments={countCache[asset.id] > asset.comments.length} + moreComments={hasOlderComments} loadMore={this.props.loadMore} /> } diff --git a/client/coral-embed-stream/src/NewCount.js b/client/coral-embed-stream/src/NewCount.js index 2368c1ab8..8d7333aab 100644 --- a/client/coral-embed-stream/src/NewCount.js +++ b/client/coral-embed-stream/src/NewCount.js @@ -17,10 +17,10 @@ const onLoadMoreClick = ({loadMore, commentCount, firstCommentDate, assetId, upd const NewCount = (props) => { const newComments = props.commentCount - props.countCache; - return