mirror of
https://github.com/penpot/penpot.git
synced 2025-06-12 12:31:37 +02:00
🎉 Add lazy loading and storage/pointer-map support on workspace
This also rewrites the workspace load process making it a bit more efficient independently if lazy loading is used.
This commit is contained in:
parent
6565655ac3
commit
bbf95434d8
16 changed files with 387 additions and 349 deletions
|
@ -9,7 +9,6 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.common.logging :as log]
|
||||
[app.common.pages.changes :as ch]
|
||||
[app.common.transit :as t]
|
||||
[app.config :as cf]
|
||||
[okulary.core :as l]))
|
||||
|
||||
|
@ -31,29 +30,24 @@
|
|||
[message]
|
||||
message)
|
||||
|
||||
(defmethod handler :initialize-indices
|
||||
[{:keys [file-raw] :as message}]
|
||||
(defmethod handler :initialize-page-index
|
||||
[{:keys [page] :as message}]
|
||||
(swap! state update :pages-index assoc (:id page) page)
|
||||
(handler (assoc message :cmd :selection/initialize-page-index))
|
||||
(handler (assoc message :cmd :snaps/initialize-page-index)))
|
||||
|
||||
(let [data (-> (t/decode-str file-raw) :data)
|
||||
message (assoc message :data data)]
|
||||
(reset! state data)
|
||||
(handler (assoc message :cmd :selection/initialize-index))
|
||||
(handler (assoc message :cmd :snaps/initialize-index))))
|
||||
|
||||
(defmethod handler :update-page-indices
|
||||
(defmethod handler :update-page-index
|
||||
[{:keys [page-id changes] :as message}]
|
||||
|
||||
(let [old-page (dm/get-in @state [:pages-index page-id])]
|
||||
(swap! state ch/process-changes changes false)
|
||||
|
||||
(let [new-page (dm/get-in @state [:pages-index page-id])
|
||||
message (assoc message
|
||||
:old-page old-page
|
||||
:new-page new-page)]
|
||||
(handler (-> message
|
||||
(assoc :cmd :selection/update-index)))
|
||||
(handler (-> message
|
||||
(assoc :cmd :snaps/update-index))))))
|
||||
(let [old-page (dm/get-in @state [:pages-index page-id])
|
||||
new-page (-> state
|
||||
(swap! ch/process-changes changes false)
|
||||
(dm/get-in [:pages-index page-id]))
|
||||
message (assoc message
|
||||
:old-page old-page
|
||||
:new-page new-page)]
|
||||
(handler (assoc message :cmd :selection/update-page-index))
|
||||
(handler (assoc message :cmd :snaps/update-page-index))))
|
||||
|
||||
(defmethod handler :configure
|
||||
[{:keys [key val]}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue