diff options
author | Eugen <eugen@zeonfederated.com> | 2017-01-24 14:27:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 14:27:13 +0100 |
commit | 4f3264d2912d1b70a22099f1c713691f91ba890d (patch) | |
tree | 8a48ce38d47351bc3739cebd3672d40c98763807 /app/assets/javascripts/components/actions/timelines.jsx | |
parent | 4a146a0d189280dbd15098f42850ca550e0d7910 (diff) | |
parent | 21c209636d12ea601379e7abd3d370ad0d22ea18 (diff) |
Merge branch 'master' into boostspin
Diffstat (limited to 'app/assets/javascripts/components/actions/timelines.jsx')
-rw-r--r-- | app/assets/javascripts/components/actions/timelines.jsx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx index 72e949e87..29a060e87 100644 --- a/app/assets/javascripts/components/actions/timelines.jsx +++ b/app/assets/javascripts/components/actions/timelines.jsx @@ -63,6 +63,10 @@ export function refreshTimelineRequest(timeline, id, skipLoading) { export function refreshTimeline(timeline, id = null) { return function (dispatch, getState) { + if (getState().getIn(['timelines', timeline, 'isLoading'])) { + return; + } + const ids = getState().getIn(['timelines', timeline, 'items'], Immutable.List()); const newestId = ids.size > 0 ? ids.first() : null; @@ -102,8 +106,9 @@ export function expandTimeline(timeline, id = null) { return (dispatch, getState) => { const lastId = getState().getIn(['timelines', timeline, 'items'], Immutable.List()).last(); - if (!lastId) { + if (!lastId || getState().getIn(['timelines', timeline, 'isLoading'])) { // If timeline is empty, don't try to load older posts since there are none + // Also if already loading return; } @@ -115,7 +120,12 @@ export function expandTimeline(timeline, id = null) { path = `${path}/${id}` } - api(getState).get(`/api/v1/timelines/${path}?max_id=${lastId}`).then(response => { + api(getState).get(`/api/v1/timelines/${path}`, { + params: { + limit: 10, + max_id: lastId + } + }).then(response => { dispatch(expandTimelineSuccess(timeline, response.data)); }).catch(error => { dispatch(expandTimelineFail(timeline, error)); |