mirror of
https://github.com/wassname/talk.git
synced 2026-08-14 12:50:17 +08:00
Adding NewCount component.
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user