0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 00:01:51 -05:00

🐛 Force persistence on go to dashboard.

This commit is contained in:
Andrey Antukh 2021-01-27 19:31:42 +01:00 committed by Hirunatan
parent 3348370138
commit b6f359bcb8
2 changed files with 17 additions and 7 deletions

View file

@ -227,10 +227,12 @@
(ptk/reify ::initialize-page
ptk/UpdateEvent
(update [_ state]
(let [prev-local (get state :workspace-local)
(let [;; we maintain a cache of page state for user convenience
;; with the exception of the selection; when user abandon
;; the current page, the selection is lost
local (-> state
(get-in [:workspace-cache page-id] workspace-local-default)
(merge (select-keys prev-local [:vbox :vport :zoom])))
(assoc :selected (d/ordered-set)))
page (-> (get-in state [:workspace-data :pages-index page-id])
(select-keys [:id :name]))]
(assoc state
@ -1225,6 +1227,14 @@
(rx/of ::dwp/force-persist
(rt/nav :viewer params {:index 0})))))
(defn go-to-dashboard
[{:keys [team-id] :as project}]
(ptk/reify ::go-to-viewer
ptk/WatchEvent
(watch [_ state stream]
(rx/of ::dwp/force-persist
(rt/nav :dashboard-projects {:team-id team-id})))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Context Menu
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -242,7 +242,7 @@
go-back
(mf/use-callback
(mf/deps project)
(st/emitf (rt/nav :dashboard-projects {:team-id team-id})))
(st/emitf (dw/go-to-dashboard project)))
go-viewer
(mf/use-callback