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,12 +227,14 @@
(ptk/reify ::initialize-page (ptk/reify ::initialize-page
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(let [prev-local (get state :workspace-local) (let [;; we maintain a cache of page state for user convenience
local (-> state ;; with the exception of the selection; when user abandon
(get-in [:workspace-cache page-id] workspace-local-default) ;; the current page, the selection is lost
(merge (select-keys prev-local [:vbox :vport :zoom]))) local (-> state
page (-> (get-in state [:workspace-data :pages-index page-id]) (get-in [:workspace-cache page-id] workspace-local-default)
(select-keys [:id :name]))] (assoc :selected (d/ordered-set)))
page (-> (get-in state [:workspace-data :pages-index page-id])
(select-keys [:id :name]))]
(assoc state (assoc state
:current-page-id page-id ; mainly used by events :current-page-id page-id ; mainly used by events
:trimmed-page page :trimmed-page page
@ -1225,6 +1227,14 @@
(rx/of ::dwp/force-persist (rx/of ::dwp/force-persist
(rt/nav :viewer params {:index 0}))))) (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 ;; Context Menu
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

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