diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-11-10 15:04:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-10 15:04:13 +0100 |
commit | 3cecf3e5b995f5035b17fd9572c17ba1ede9346b (patch) | |
tree | 945d7c515c6bd4fac1923a1635016bc2c6657a29 /app/javascript/mastodon/actions/timelines.js | |
parent | 2f86fc5e0a45eb2002d4b481ae093197ad523479 (diff) |
Fix loading indicator inconsistency (#9252)
* Use global loading indicator when loading more items * Use local loading indicator for notifications And remove global loading indicator for initial custom emojis load
Diffstat (limited to 'app/javascript/mastodon/actions/timelines.js')
-rw-r--r-- | app/javascript/mastodon/actions/timelines.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 74ad55652..81c4c8425 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -63,6 +63,7 @@ const parseTags = (tags = {}, mode) => { export function expandTimeline(timelineId, path, params = {}, done = noOp) { return (dispatch, getState) => { const timeline = getState().getIn(['timelines', timelineId], ImmutableMap()); + const isLoadingMore = !!params.max_id; if (timeline.get('isLoading')) { done(); @@ -73,15 +74,15 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) { params.since_id = timeline.getIn(['items', 0]); } - dispatch(expandTimelineRequest(timelineId)); + dispatch(expandTimelineRequest(timelineId, isLoadingMore)); api(getState).get(path, { params }).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(importFetchedStatuses(response.data)); - dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.code === 206)); + dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.code === 206, isLoadingMore)); done(); }).catch(error => { - dispatch(expandTimelineFail(timelineId, error)); + dispatch(expandTimelineFail(timelineId, error, isLoadingMore)); done(); }); }; @@ -103,31 +104,31 @@ export const expandHashtagTimeline = (hashtag, { maxId, tags } = {}, don }, done); }; -export function expandTimelineRequest(timeline) { +export function expandTimelineRequest(timeline, isLoadingMore) { return { type: TIMELINE_EXPAND_REQUEST, timeline, - skipLoading: true, + skipLoading: !isLoadingMore, }; }; -export function expandTimelineSuccess(timeline, statuses, next, partial) { +export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadingMore) { return { type: TIMELINE_EXPAND_SUCCESS, timeline, statuses, next, partial, - skipLoading: true, + skipLoading: !isLoadingMore, }; }; -export function expandTimelineFail(timeline, error) { +export function expandTimelineFail(timeline, error, isLoadingMore) { return { type: TIMELINE_EXPAND_FAIL, timeline, error, - skipLoading: true, + skipLoading: !isLoadingMore, }; }; |