diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-01 01:43:29 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-01 01:43:29 +0100 |
commit | fbdb3bcf1ede96d97693165c485f1eabc44b9f8b (patch) | |
tree | 7df5d7bd6804be4e2336e1edaa4625c5f54354ee /app/assets/javascripts/components/features | |
parent | e1b00757a69ff1cb49311addb7aa76650d680e43 (diff) |
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)
Diffstat (limited to 'app/assets/javascripts/components/features')
-rw-r--r-- | app/assets/javascripts/components/features/community_timeline/index.jsx | 16 | ||||
-rw-r--r-- | app/assets/javascripts/components/features/public_timeline/index.jsx | 16 |
2 files changed, 22 insertions, 10 deletions
diff --git a/app/assets/javascripts/components/features/community_timeline/index.jsx b/app/assets/javascripts/components/features/community_timeline/index.jsx index aa1b8368e..2cfd7b2fe 100644 --- a/app/assets/javascripts/components/features/community_timeline/index.jsx +++ b/app/assets/javascripts/components/features/community_timeline/index.jsx @@ -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 () { diff --git a/app/assets/javascripts/components/features/public_timeline/index.jsx b/app/assets/javascripts/components/features/public_timeline/index.jsx index ce4eacc92..b2342abbd 100644 --- a/app/assets/javascripts/components/features/public_timeline/index.jsx +++ b/app/assets/javascripts/components/features/public_timeline/index.jsx @@ -20,6 +20,8 @@ const mapStateToProps = state => ({ accessToken: state.getIn(['meta', 'access_token']) }); +let subscription; + const PublicTimeline = React.createClass({ propTypes: { @@ -36,7 +38,11 @@ const PublicTimeline = React.createClass({ dispatch(refreshTimeline('public')); - this.subscription = createStream(accessToken, 'public', { + if (typeof subscription !== 'undefined') { + return; + } + + subscription = createStream(accessToken, 'public', { received (data) { switch(data.event) { @@ -53,10 +59,10 @@ const PublicTimeline = React.createClass({ }, componentWillUnmount () { - if (typeof this.subscription !== 'undefined') { - this.subscription.close(); - this.subscription = null; - } + // if (typeof subscription !== 'undefined') { + // subscription.close(); + // subscription = null; + // } }, render () { |