0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 21:09:00 -05:00

📎 Add migration for cleaning unused props on file data.

This commit is contained in:
Andrey Antukh 2021-07-15 16:50:56 +02:00
parent 7c98336148
commit 946309a485
2 changed files with 11 additions and 3 deletions

View file

@ -8,7 +8,7 @@
(:require (:require
[app.common.uuid :as uuid])) [app.common.uuid :as uuid]))
(def file-version 8) (def file-version 10)
(def default-color "#b1b2b5") ;; $color-gray-20 (def default-color "#b1b2b5") ;; $color-gray-20
(def root uuid/zero) (def root uuid/zero)

View file

@ -234,7 +234,7 @@
(:shapes shape)))))) (:shapes shape))))))
(map :id))) (map :id)))
(update-page [[page-id page]] (calculate-changes [[page-id page]]
(let [objects (:objects page) (let [objects (:objects page)
eids (find-empty-groups objects)] eids (find-empty-groups objects)]
@ -245,7 +245,15 @@
eids)))] eids)))]
(loop [data data] (loop [data data]
(let [changes (mapcat update-page (:pages-index data))] (let [changes (mapcat calculate-changes (:pages-index data))]
(if (seq changes) (if (seq changes)
(recur (cp/process-changes data changes)) (recur (cp/process-changes data changes))
data))))) data)))))
(defmethod migrate 10
[data]
(letfn [(update-page [_ page]
(d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))]
(update data :pages-index #(d/mapm update-page %))))