mirror of
https://github.com/penpot/penpot.git
synced 2025-02-12 18:18:24 -05:00
🐛 Fix default page id in workspace
This commit is contained in:
parent
4663c296cd
commit
2927b0cfc6
3 changed files with 11 additions and 2 deletions
|
@ -49,6 +49,7 @@
|
|||
- Fix keep name of component equal to the shape name [Taiga #2341](https://tree.taiga.io/project/penpot/issue/2341)
|
||||
- Fix lossing changes when changing selection and an input was already changed [Taiga #2329](https://tree.taiga.io/project/penpot/issue/2329), [Taiga #2330](https://tree.taiga.io/project/penpot/issue/2330)
|
||||
- Fix blur input field when click on viewport [Taiga #2164](https://tree.taiga.io/project/penpot/issue/2164)
|
||||
- Fix default page id in workspace [Taiga #2205](https://tree.taiga.io/project/penpot/issue/2205)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
|
|
|
@ -253,17 +253,24 @@
|
|||
(->> (rx/of ::dwp/finalize)
|
||||
(rx/observe-on :async))))))
|
||||
|
||||
(declare go-to-page)
|
||||
(defn initialize-page
|
||||
[page-id]
|
||||
(us/assert ::us/uuid page-id)
|
||||
(ptk/reify ::initialize-page
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(when-not (contains? (get-in state [:workspace-data :pages-index]) page-id)
|
||||
(let [default-page-id (get-in state [:workspace-data :pages 0])]
|
||||
(rx/of (go-to-page default-page-id)))))
|
||||
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(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
|
||||
|
||||
page (get-in state [:workspace-data :pages-index page-id])
|
||||
page-id (:id page)
|
||||
local (-> state
|
||||
(get-in [:workspace-cache page-id] workspace-local-default)
|
||||
(assoc :selected (d/ordered-set)))]
|
||||
|
|
|
@ -87,7 +87,8 @@
|
|||
|
||||
(mf/defc workspace-page
|
||||
[{:keys [file layout page-id] :as props}]
|
||||
(mf/use-layout-effect
|
||||
|
||||
(mf/use-layout-effect
|
||||
(mf/deps page-id)
|
||||
(fn []
|
||||
(if (nil? page-id)
|
||||
|
|
Loading…
Add table
Reference in a new issue