Prevent duplicate load of favourites (tootsuite pr #5931)

This commit is contained in:
cwm
2018-01-09 08:46:35 -06:00
parent ce7f4aef16
commit 5963630c63
3 changed files with 24 additions and 4 deletions

View File

@ -10,6 +10,10 @@ export const FAVOURITED_STATUSES_EXPAND_FAIL = 'FAVOURITED_STATUSES_EXPAND_FA
export function fetchFavouritedStatuses() {
return (dispatch, getState) => {
if (getState().getIn(['status_lists', 'favourites', 'isLoading'])) {
return;
}
dispatch(fetchFavouritedStatusesRequest());
api(getState).get('/api/v1/favourites').then(response => {
@ -46,7 +50,7 @@ export function expandFavouritedStatuses() {
return (dispatch, getState) => {
const url = getState().getIn(['status_lists', 'favourites', 'next'], null);
if (url === null) {
if (url === null || getState().getIn(['status_lists', 'favourites', 'isLoading'])) {
return;
}