Remove unnecessary API calls on first page load (#6762)

This commit is contained in:
Joram Wilander
2017-06-27 23:49:03 -04:00
committed by Corey Hulen
parent 0b62078712
commit a2f7de52c3

View File

@@ -103,18 +103,17 @@ function preNeedsTeam(nextState, replace, callback) {
return;
}
// If current team is set, then this is not first load
// The first load action pulls team unreads
if (TeamStore.getCurrentId()) {
getMyTeamUnreads()(dispatch, getState);
}
TeamStore.saveMyTeam(team);
BrowserStore.setGlobalItem('team', team.id);
TeamStore.emitChange();
GlobalActions.emitCloseRightHandSide();
if (nextState.location.pathname.indexOf('/channels/') > -1 ||
nextState.location.pathname.indexOf('/pl/') > -1 ||
nextState.location.pathname.indexOf('/messages/') > -1) {
getMyTeamUnreads()(dispatch, getState);
fetchMyChannelsAndMembers(team.id)(dispatch, getState);
}
const d1 = $.Deferred(); //eslint-disable-line new-cap
fetchMyChannelsAndMembers(team.id)(dispatch, getState).then(