mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Remove unnecessary API calls on first page load (#6762)
This commit is contained in:
committed by
Corey Hulen
parent
0b62078712
commit
a2f7de52c3
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user