add polling to permalink page

This commit is contained in:
Riley Davis
2017-03-31 09:16:21 -06:00
committed by riley
parent a1bb0cd55f
commit 093c13c103
2 changed files with 23 additions and 25 deletions
-21
View File
@@ -1,6 +1,5 @@
import React, {PropTypes} from 'react';
import Comment from './Comment';
import {NEW_COMMENT_COUNT_POLL_INTERVAL} from 'coral-framework/constants/comments';
class Stream extends React.Component {
@@ -27,26 +26,6 @@ class Stream extends React.Component {
this.state = {activeReplyBox: '', countPoll: null};
}
componentDidMount() {
const {asset, getCounts, updateCountCache} = this.props;
updateCountCache(asset.id, asset.commentCount);
// Note: Apollo's built-in polling doesn't work with fetchMore queries, so a
// setInterval is being used instead.
this.setState({
countPoll: setInterval(() => getCounts({
asset_id: asset.id,
limit: asset.comments.length,
sort: 'REVERSE_CHRONOLOGICAL'
}), NEW_COMMENT_COUNT_POLL_INTERVAL),
});
}
componentWillUnmount() {
clearInterval(this.state.countPoll);
}
render () {
const {
comments,