dispatch(updateTimeline('home', { ...response.data }));
if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {
- dispatch(updateTimeline('community', { ...response.data }));
- dispatch(updateTimeline('public', { ...response.data }));
+ if (getState.getIn(['timelines', 'community', 'loaded'])) {
+ dispatch(updateTimeline('community', { ...response.data }));
+ }
+
+ if (getState.getIn(['timelines', 'public', 'loaded'])) {
+ dispatch(updateTimeline('public', { ...response.data }));
+ }
}
}).catch(function (error) {
dispatch(submitComposeFail(error));
return;
}
- const next = getState().getIn(['timelines', timeline, 'next']);
- const params = getState().getIn(['timelines', timeline, 'params'], {});
-
- if (next === null) {
+ if (getState().getIn(['timelines', timeline, 'items']).size === 0) {
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));
- api(getState).get(next, {
+ api(getState).get(path, {
params: {
...params,
+ max_id: lastId,
limit: 10
}
}).then(response => {
accessToken: state.getIn(['meta', 'access_token'])
});
+let subscription;
+
const CommunityTimeline = React.createClass({
propTypes: {
dispatch(refreshTimeline('community'));
- this.subscription = createStream(accessToken, 'public:local', {
+ if (typeof subscription !== 'undefined') {
+ return;
+ }
+
+ subscription = createStream(accessToken, 'public:local', {
received (data) {
switch(data.event) {
},
componentWillUnmount () {
- if (typeof this.subscription !== 'undefined') {
- this.subscription.close();
- this.subscription = null;
- }
+ // if (typeof subscription !== 'undefined') {
+ // subscription.close();
+ // subscription = null;
+ // }
},
render () {
accessToken: state.getIn(['meta', 'access_token'])
});
+let subscription;
+
const PublicTimeline = React.createClass({
propTypes: {
dispatch(refreshTimeline('public'));
- this.subscription = createStream(accessToken, 'public', {
+ if (typeof subscription !== 'undefined') {
+ return;
+ }
+
+ subscription = createStream(accessToken, 'public', {
received (data) {
switch(data.event) {
},
componentWillUnmount () {
- if (typeof this.subscription !== 'undefined') {
- this.subscription.close();
- this.subscription = null;
- }
+ // if (typeof subscription !== 'undefined') {
+ // subscription.close();
+ // subscription = null;
+ // }
},
render () {
color: $color1;
overflow: hidden;
text-overflow: ellipsis;
+ white-space: nowrap;
&:focus {
outline: none;