mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 01:36:39 +02:00
✨ Simplify feature handling on components-v2 migration functions
This commit is contained in:
parent
da15924de0
commit
eee28a5793
1 changed files with 9 additions and 17 deletions
|
@ -9,7 +9,6 @@
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.features :as cfeat]
|
|
||||||
[app.common.files.changes :as cp]
|
[app.common.files.changes :as cp]
|
||||||
[app.common.files.changes-builder :as fcb]
|
[app.common.files.changes-builder :as fcb]
|
||||||
[app.common.files.helpers :as cfh]
|
[app.common.files.helpers :as cfh]
|
||||||
|
@ -769,12 +768,13 @@
|
||||||
fdata (migrate-graphics fdata)]
|
fdata (migrate-graphics fdata)]
|
||||||
(update fdata :options assoc :components-v2 true)))))
|
(update fdata :options assoc :components-v2 true)))))
|
||||||
|
|
||||||
(defn- prepare-fdata
|
(defn- get-file
|
||||||
[fdata id]
|
[system id]
|
||||||
(-> fdata
|
(binding [pmap/*load-fn* (partial fdata/load-pointer system id)]
|
||||||
(assoc :id id)
|
(-> (files/get-file system id :migrate? false)
|
||||||
(fdata/process-pointers deref)
|
(update :data assoc :id id)
|
||||||
(fmg/migrate-data)))
|
(update :data fdata/process-pointers deref)
|
||||||
|
(fmg/migrate-file))))
|
||||||
|
|
||||||
(defn- validate-file!
|
(defn- validate-file!
|
||||||
[file libs throw-on-validate?]
|
[file libs throw-on-validate?]
|
||||||
|
@ -788,18 +788,10 @@
|
||||||
|
|
||||||
(defn- process-file
|
(defn- process-file
|
||||||
[{:keys [::db/conn] :as system} id & {:keys [validate? throw-on-validate?]}]
|
[{:keys [::db/conn] :as system} id & {:keys [validate? throw-on-validate?]}]
|
||||||
(let [file (binding [cfeat/*new* (atom #{})
|
(let [file (get-file system id)
|
||||||
pmap/*load-fn* (partial fdata/load-pointer system id)]
|
|
||||||
(-> (files/get-file system id :migrate? false)
|
|
||||||
(update :data prepare-fdata id)
|
|
||||||
(update :features into (deref cfeat/*new*))
|
|
||||||
(update :features cfeat/migrate-legacy-features)))
|
|
||||||
|
|
||||||
libs (->> (files/get-file-libraries conn id)
|
libs (->> (files/get-file-libraries conn id)
|
||||||
(into [file] (map (fn [{:keys [id]}]
|
(into [file] (comp (map :id) (map (partial get-file system))))
|
||||||
(binding [pmap/*load-fn* (partial fdata/load-pointer system id)]
|
|
||||||
(-> (files/get-file system id :migrate? false)
|
|
||||||
(update :data prepare-fdata id))))))
|
|
||||||
(d/index-by :id))
|
(d/index-by :id))
|
||||||
|
|
||||||
file (-> file
|
file (-> file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue