mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-01 19:14:23 +00:00
Disable real-time updates on public pages to improve readability (#10260)
This commit is contained in:
parent
f85b66eb8c
commit
42c581c458
|
@ -3,7 +3,6 @@ import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { expandHashtagTimeline } from 'mastodon/actions/timelines';
|
import { expandHashtagTimeline } from 'mastodon/actions/timelines';
|
||||||
import { connectHashtagStream } from 'mastodon/actions/streaming';
|
|
||||||
import Masonry from 'react-masonry-infinite';
|
import Masonry from 'react-masonry-infinite';
|
||||||
import { List as ImmutableList } from 'immutable';
|
import { List as ImmutableList } from 'immutable';
|
||||||
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
|
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
|
||||||
|
@ -31,14 +30,6 @@ class HashtagTimeline extends React.PureComponent {
|
||||||
const { dispatch, hashtag } = this.props;
|
const { dispatch, hashtag } = this.props;
|
||||||
|
|
||||||
dispatch(expandHashtagTimeline(hashtag));
|
dispatch(expandHashtagTimeline(hashtag));
|
||||||
this.disconnect = dispatch(connectHashtagStream(hashtag, hashtag));
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount () {
|
|
||||||
if (this.disconnect) {
|
|
||||||
this.disconnect();
|
|
||||||
this.disconnect = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoadMore = () => {
|
handleLoadMore = () => {
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { expandPublicTimeline, expandCommunityTimeline } from 'mastodon/actions/timelines';
|
import { expandPublicTimeline, expandCommunityTimeline } from 'mastodon/actions/timelines';
|
||||||
import { connectPublicStream, connectCommunityStream } from 'mastodon/actions/streaming';
|
|
||||||
import Masonry from 'react-masonry-infinite';
|
import Masonry from 'react-masonry-infinite';
|
||||||
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
||||||
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
|
import DetailedStatusContainer from 'mastodon/features/status/containers/detailed_status_container';
|
||||||
|
@ -37,27 +36,14 @@ class PublicTimeline extends React.PureComponent {
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
if (prevProps.local !== this.props.local) {
|
if (prevProps.local !== this.props.local) {
|
||||||
this._disconnect();
|
|
||||||
this._connect();
|
this._connect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
|
||||||
this._disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
_connect () {
|
_connect () {
|
||||||
const { dispatch, local } = this.props;
|
const { dispatch, local } = this.props;
|
||||||
|
|
||||||
dispatch(local ? expandCommunityTimeline() : expandPublicTimeline());
|
dispatch(local ? expandCommunityTimeline() : expandPublicTimeline());
|
||||||
this.disconnect = dispatch(local ? connectCommunityStream() : connectPublicStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
_disconnect () {
|
|
||||||
if (this.disconnect) {
|
|
||||||
this.disconnect();
|
|
||||||
this.disconnect = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoadMore = () => {
|
handleLoadMore = () => {
|
||||||
|
|
Loading…
Reference in a new issue