From 21c209636d12ea601379e7abd3d370ad0d22ea18 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 24 Jan 2017 13:04:12 +0100 Subject: Set isLoading false on timelines when request fails --- app/assets/javascripts/components/actions/timelines.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/assets/javascripts/components/actions') diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx index 1d7e0547c..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; } -- cgit