0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-16 01:31:22 -05:00

🐛 Add migration for fix unreferenced shapes on frames.

This commit is contained in:
Andrey Antukh 2021-07-15 17:23:51 +02:00
parent 946309a485
commit f29d54ad0d
2 changed files with 12 additions and 1 deletions

View file

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

View file

@ -256,4 +256,15 @@
(d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))]
(update data :pages-index #(d/mapm update-page %))))
(defmethod migrate 11
[data]
(letfn [(update-object [objects id shape]
(if (= :frame (:type shape))
(d/update-when shape :shapes (fn [shapes]
(filterv (fn [id] (contains? objects id)) shapes)))
shape))
(update-page [id {:keys [objects] :as page}]
(d/mapm (partial update-object objects) objects))]
(update data :pages-index #(d/mapm update-page %))))