From a574397a7256bed7738f499019f97ab468b5161d Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Wed, 11 May 2016 11:44:45 -0400
Subject: Pull direct profiles when switching teams (#2965)

---
 webapp/root.jsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'webapp/root.jsx')

diff --git a/webapp/root.jsx b/webapp/root.jsx
index 3f1edda38..2b54c2174 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -132,6 +132,7 @@ function preNeedsTeam(nextState, replace, callback) {
     // for the current url.
     var teamName = Utils.getTeamNameFromUrl();
     var team = TeamStore.getByName(teamName);
+    const oldTeamId = TeamStore.getCurrentId();
 
     if (!team) {
         browserHistory.push('/');
@@ -143,6 +144,12 @@ function preNeedsTeam(nextState, replace, callback) {
     TeamStore.saveMyTeam(team);
     TeamStore.emitChange();
 
+    // If the old team id is null then we will already have the direct
+    // profiles from initial load
+    if (oldTeamId != null) {
+        AsyncClient.getDirectProfiles();
+    }
+
     var d1 = $.Deferred(); //eslint-disable-line new-cap
     var d2 = $.Deferred(); //eslint-disable-line new-cap
 
-- 
cgit v1.2.3-1-g7c22

