mirror of
https://github.com/penpot/penpot.git
synced 2025-04-16 08:51:32 -05:00
🐛 Properly handle current team id assignation.
This commit is contained in:
parent
8a0bba3c7a
commit
cfbbb85254
2 changed files with 15 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
[]
|
||||
|
|
Loading…
Add table
Reference in a new issue