forked from treehouse/mastodon
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)signup-info-prompt
parent
e1b00757a6
commit
fbdb3bcf1e
|
@ -85,8 +85,13 @@ export function submitCompose() {
|
||||||
dispatch(updateTimeline('home', { ...response.data }));
|
dispatch(updateTimeline('home', { ...response.data }));
|
||||||
|
|
||||||
if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {
|
if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {
|
||||||
dispatch(updateTimeline('community', { ...response.data }));
|
if (getState.getIn(['timelines', 'community', 'loaded'])) {
|
||||||
dispatch(updateTimeline('public', { ...response.data }));
|
dispatch(updateTimeline('community', { ...response.data }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getState.getIn(['timelines', 'public', 'loaded'])) {
|
||||||
|
dispatch(updateTimeline('public', { ...response.data }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
dispatch(submitComposeFail(error));
|
dispatch(submitComposeFail(error));
|
||||||
|
|
|
@ -106,18 +106,20 @@ export function expandTimeline(timeline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const next = getState().getIn(['timelines', timeline, 'next']);
|
if (getState().getIn(['timelines', timeline, 'items']).size === 0) {
|
||||||
const params = getState().getIn(['timelines', timeline, 'params'], {});
|
|
||||||
|
|
||||||
if (next === null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const path = getState().getIn(['timelines', timeline, 'path'])(getState().getIn(['timelines', timeline, 'id']));
|
||||||
|
const params = getState().getIn(['timelines', timeline, 'params'], {});
|
||||||
|
const lastId = getState().getIn(['timelines', timeline, 'items']).last();
|
||||||
|
|
||||||
dispatch(expandTimelineRequest(timeline));
|
dispatch(expandTimelineRequest(timeline));
|
||||||
|
|
||||||
api(getState).get(next, {
|
api(getState).get(path, {
|
||||||
params: {
|
params: {
|
||||||
...params,
|
...params,
|
||||||
|
max_id: lastId,
|
||||||
limit: 10
|
limit: 10
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
|
|
|
@ -20,6 +20,8 @@ const mapStateToProps = state => ({
|
||||||
accessToken: state.getIn(['meta', 'access_token'])
|
accessToken: state.getIn(['meta', 'access_token'])
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let subscription;
|
||||||
|
|
||||||
const CommunityTimeline = React.createClass({
|
const CommunityTimeline = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
@ -36,7 +38,11 @@ const CommunityTimeline = React.createClass({
|
||||||
|
|
||||||
dispatch(refreshTimeline('community'));
|
dispatch(refreshTimeline('community'));
|
||||||
|
|
||||||
this.subscription = createStream(accessToken, 'public:local', {
|
if (typeof subscription !== 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
subscription = createStream(accessToken, 'public:local', {
|
||||||
|
|
||||||
received (data) {
|
received (data) {
|
||||||
switch(data.event) {
|
switch(data.event) {
|
||||||
|
@ -53,10 +59,10 @@ const CommunityTimeline = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
if (typeof this.subscription !== 'undefined') {
|
// if (typeof subscription !== 'undefined') {
|
||||||
this.subscription.close();
|
// subscription.close();
|
||||||
this.subscription = null;
|
// subscription = null;
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|
|
@ -20,6 +20,8 @@ const mapStateToProps = state => ({
|
||||||
accessToken: state.getIn(['meta', 'access_token'])
|
accessToken: state.getIn(['meta', 'access_token'])
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let subscription;
|
||||||
|
|
||||||
const PublicTimeline = React.createClass({
|
const PublicTimeline = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
@ -36,7 +38,11 @@ const PublicTimeline = React.createClass({
|
||||||
|
|
||||||
dispatch(refreshTimeline('public'));
|
dispatch(refreshTimeline('public'));
|
||||||
|
|
||||||
this.subscription = createStream(accessToken, 'public', {
|
if (typeof subscription !== 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
subscription = createStream(accessToken, 'public', {
|
||||||
|
|
||||||
received (data) {
|
received (data) {
|
||||||
switch(data.event) {
|
switch(data.event) {
|
||||||
|
@ -53,10 +59,10 @@ const PublicTimeline = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
if (typeof this.subscription !== 'undefined') {
|
// if (typeof subscription !== 'undefined') {
|
||||||
this.subscription.close();
|
// subscription.close();
|
||||||
this.subscription = null;
|
// subscription = null;
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|
|
@ -576,6 +576,7 @@ a.status__content__spoiler-link {
|
||||||
color: $color1;
|
color: $color1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
Loading…
Reference in New Issue