Revert infinite scroll in timelines back to looking at ID of oldest
loaded status; do not preload submitted statuses into community/public timelines, unless those timelines have already been loaded; do not close streaming API connections for community/public timelines, once they have been established (most users navigate back to them eventually)
This commit is contained in:
parent
e1b00757a6
commit
fbdb3bcf1e
5 changed files with 37 additions and 17 deletions
|
@ -20,6 +20,8 @@ const mapStateToProps = state => ({
|
|||
accessToken: state.getIn(['meta', 'access_token'])
|
||||
});
|
||||
|
||||
let subscription;
|
||||
|
||||
const CommunityTimeline = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
|
@ -36,7 +38,11 @@ const CommunityTimeline = React.createClass({
|
|||
|
||||
dispatch(refreshTimeline('community'));
|
||||
|
||||
this.subscription = createStream(accessToken, 'public:local', {
|
||||
if (typeof subscription !== 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
subscription = createStream(accessToken, 'public:local', {
|
||||
|
||||
received (data) {
|
||||
switch(data.event) {
|
||||
|
@ -53,10 +59,10 @@ const CommunityTimeline = React.createClass({
|
|||
},
|
||||
|
||||
componentWillUnmount () {
|
||||
if (typeof this.subscription !== 'undefined') {
|
||||
this.subscription.close();
|
||||
this.subscription = null;
|
||||
}
|
||||
// if (typeof subscription !== 'undefined') {
|
||||
// subscription.close();
|
||||
// subscription = null;
|
||||
// }
|
||||
},
|
||||
|
||||
render () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue