mirror of
https://github.com/penpot/penpot.git
synced 2025-07-23 18:57:18 +02: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/reify ::initialize
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
|
(du/set-current-team! id)
|
||||||
(let [prev-team-id (:current-team-id state)]
|
(let [prev-team-id (:current-team-id state)]
|
||||||
(cond-> state
|
(cond-> state
|
||||||
(not= prev-team-id id)
|
(not= prev-team-id id)
|
||||||
|
@ -748,7 +749,6 @@
|
||||||
(ptk/reify ::go-to-projects-1
|
(ptk/reify ::go-to-projects-1
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(du/set-current-team! team-id)
|
|
||||||
(rx/of (rt/nav :dashboard-projects {:team-id team-id}))))))
|
(rx/of (rt/nav :dashboard-projects {:team-id team-id}))))))
|
||||||
|
|
||||||
(defn go-to-team-members
|
(defn go-to-team-members
|
||||||
|
|
|
@ -62,14 +62,26 @@
|
||||||
|
|
||||||
(defn teams-fetched
|
(defn teams-fetched
|
||||||
[teams]
|
[teams]
|
||||||
(let [teams (d/index-by :id teams)]
|
(let [teams (d/index-by :id teams)
|
||||||
|
ids (into #{} (keys teams))]
|
||||||
|
|
||||||
(ptk/reify ::teams-fetched
|
(ptk/reify ::teams-fetched
|
||||||
IDeref
|
IDeref
|
||||||
(-deref [_] teams)
|
(-deref [_] teams)
|
||||||
|
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(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
|
(defn fetch-teams
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue