export function fetchCustomEmojisRequest() {
return {
type: CUSTOM_EMOJIS_FETCH_REQUEST,
+ skipLoading: true,
};
};
return {
type: CUSTOM_EMOJIS_FETCH_SUCCESS,
custom_emojis,
+ skipLoading: true,
};
};
return {
type: CUSTOM_EMOJIS_FETCH_FAIL,
error,
+ skipLoading: true,
};
};
export function fetchFavouritedStatusesRequest() {
return {
type: FAVOURITED_STATUSES_FETCH_REQUEST,
+ skipLoading: true,
};
};
type: FAVOURITED_STATUSES_FETCH_SUCCESS,
statuses,
next,
+ skipLoading: true,
};
};
return {
type: FAVOURITED_STATUSES_FETCH_FAIL,
error,
+ skipLoading: true,
};
};
export function expandNotifications({ maxId } = {}, done = noOp) {
return (dispatch, getState) => {
const notifications = getState().get('notifications');
+ const isLoadingMore = !!maxId;
if (notifications.get('isLoading')) {
done();
params.since_id = notifications.getIn(['items', 0]);
}
- dispatch(expandNotificationsRequest());
+ dispatch(expandNotificationsRequest(isLoadingMore));
api(getState).get('/api/v1/notifications', { params }).then(response => {
const next = getLinks(response).refs.find(link => link.rel === 'next');
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
- dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null));
+ dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null, isLoadingMore));
fetchRelatedRelationships(dispatch, response.data);
done();
}).catch(error => {
- dispatch(expandNotificationsFail(error));
+ dispatch(expandNotificationsFail(error, isLoadingMore));
done();
});
};
};
-export function expandNotificationsRequest() {
+export function expandNotificationsRequest(isLoadingMore) {
return {
type: NOTIFICATIONS_EXPAND_REQUEST,
+ skipLoading: !isLoadingMore,
};
};
-export function expandNotificationsSuccess(notifications, next) {
+export function expandNotificationsSuccess(notifications, next, isLoadingMore) {
return {
type: NOTIFICATIONS_EXPAND_SUCCESS,
notifications,
next,
+ skipLoading: !isLoadingMore,
};
};
-export function expandNotificationsFail(error) {
+export function expandNotificationsFail(error, isLoadingMore) {
return {
type: NOTIFICATIONS_EXPAND_FAIL,
error,
+ skipLoading: !isLoadingMore,
};
};
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();
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();
});
};
}, 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,
};
};
scrollKey={`notifications-${columnId}`}
trackScroll={!pinned}
isLoading={isLoading}
+ showLoading={isLoading && notifications.size === 0}
hasMore={hasMore}
emptyMessage={emptyMessage}
onLoadMore={this.handleLoadOlder}