diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 6df1557ad6..f1cba5becf 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -67,6 +67,7 @@ (ptk/reify ::initialize ptk/UpdateEvent (update [_ state] + (du/set-current-team! id) (let [prev-team-id (:current-team-id state)] (cond-> state (not= prev-team-id id) @@ -748,7 +749,6 @@ (ptk/reify ::go-to-projects-1 ptk/WatchEvent (watch [_ _ _] - (du/set-current-team! team-id) (rx/of (rt/nav :dashboard-projects {:team-id team-id})))))) (defn go-to-team-members diff --git a/frontend/src/app/main/data/users.cljs b/frontend/src/app/main/data/users.cljs index 07ad91268b..b894cdeff2 100644 --- a/frontend/src/app/main/data/users.cljs +++ b/frontend/src/app/main/data/users.cljs @@ -62,14 +62,26 @@ (defn teams-fetched [teams] - (let [teams (d/index-by :id teams)] + (let [teams (d/index-by :id teams) + ids (into #{} (keys teams))] + (ptk/reify ::teams-fetched IDeref (-deref [_] teams) ptk/UpdateEvent (update [_ state] - (assoc state :teams teams))))) + (assoc state :teams teams)) + + ptk/EffectEvent + (effect [_ _ _] + ;; Check if current team-id is part of available teams + ;; if not, dissoc it from storage. + (when-let [ctid (::current-team-id @storage)] + (when-not (contains? ids ctid) + (swap! storage dissoc ::current-team-id))))))) + + (defn fetch-teams []