0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -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
[app.common.uuid :as uuid]))
(def file-version 8)
(def file-version 10)
(def default-color "#b1b2b5") ;; $color-gray-20
(def root uuid/zero)

View file

@ -234,7 +234,7 @@
(:shapes shape))))))
(map :id)))
(update-page [[page-id page]]
(calculate-changes [[page-id page]]
(let [objects (:objects page)
eids (find-empty-groups objects)]
@ -245,7 +245,15 @@
eids)))]
(loop [data data]
(let [changes (mapcat update-page (:pages-index data))]
(let [changes (mapcat calculate-changes (:pages-index data))]
(if (seq changes)
(recur (cp/process-changes data changes))
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 %))))