Adding NewCount component.

This commit is contained in:
David Jay
2017-02-22 13:13:25 -05:00
parent ca107afb9b
commit dd09ddf968
3 changed files with 9 additions and 5 deletions
+5 -1
View File
@@ -151,7 +151,11 @@ class Embed extends Component {
}
{!loggedIn && <SignInContainer requireEmailConfirmation={asset.settings.requireEmailConfirmation} offset={signInOffset}/>}
{loggedIn && user && <ChangeUsernameContainer loggedIn={loggedIn} offset={signInOffset} user={user} />}
<NewCount commentCount={asset.commentCount} countCache={countCache[asset.id]}/>
<NewCount
commentCount={asset.commentCount}
countCache={countCache[asset.id]}
loadMore={this.props.loadMore}
/>
<Stream
refetch={refetch}
addNotification={this.props.addNotification}
+3 -3
View File
@@ -1,7 +1,6 @@
import React, {PropTypes} from 'react';
const NewCount = ({commentCount, countCache}) =>
<div>
const NewCount = ({commentCount, countCache}) => <div>
{
countCache && commentCount - countCache > 0 &&
<div>
@@ -12,7 +11,8 @@ const NewCount = ({commentCount, countCache}) =>
NewCount.propTypes = {
commentCount: PropTypes.number.isRequired,
countCache: PropTypes.number
countCache: PropTypes.number,
loadMore: PropTypes.func.isRequired
};
export default NewCount;
+1 -1
View File
@@ -24,7 +24,7 @@ class Stream extends React.Component {
componentDidMount() {
const {asset, getCounts, updateCountCache} = this.props;
updateCountCache(asset.id, asset.comments.length);
updateCountCache(asset.id, asset.commentCount);
// Note: Apollo's built-in polling doesn't work with fetchMore queries, so a
// setInterval is being used instead.