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:
parent
3348370138
commit
b6f359bcb8
2 changed files with 17 additions and 7 deletions
|
@ -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
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue