Skip to content

Commit

Permalink
Disable real-time updates on public pages to improve readability (mas…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored Mar 18, 2019
1 parent b6fa98f commit d42d4c4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { expandHashtagTimeline } from 'mastodon/actions/timelines';
import { connectHashtagStream } from 'mastodon/actions/streaming';
import Masonry from 'react-masonry-infinite';
import { List as ImmutableList } from 'immutable';
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
Expand Down Expand Up @@ -31,14 +30,6 @@ class HashtagTimeline extends React.PureComponent {
const { dispatch, hashtag } = this.props;

dispatch(expandHashtagTimeline(hashtag));
this.disconnect = dispatch(connectHashtagStream(hashtag, hashtag));
}

componentWillUnmount () {
if (this.disconnect) {
this.disconnect();
this.disconnect = null;
}
}

handleLoadMore = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { expandPublicTimeline, expandCommunityTimeline } from 'mastodon/actions/timelines';
import { connectPublicStream, connectCommunityStream } from 'mastodon/actions/streaming';
import Masonry from 'react-masonry-infinite';
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
Expand Down Expand Up @@ -37,27 +36,14 @@ class PublicTimeline extends React.PureComponent {

componentDidUpdate (prevProps) {
if (prevProps.local !== this.props.local) {
this._disconnect();
this._connect();
}
}

componentWillUnmount () {
this._disconnect();
}

_connect () {
const { dispatch, local } = this.props;

dispatch(local ? expandCommunityTimeline() : expandPublicTimeline());
this.disconnect = dispatch(local ? connectCommunityStream() : connectPublicStream());
}

_disconnect () {
if (this.disconnect) {
this.disconnect();
this.disconnect = null;
}
}

handleLoadMore = () => {
Expand Down

0 comments on commit d42d4c4

Please sign in to comment.