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

🐛 Remove broken and unfixable image shapes on comp-v2 migration

This commit is contained in:
Andrey Antukh 2024-01-17 18:08:34 +01:00
parent ba3c42e62c
commit 3e89a22600

View file

@ -115,6 +115,27 @@
(vswap! detached-ids conj (:id shape)))
(ctk/detach-shape shape)))
fix-missing-image-metadata
(fn [file-data]
(let [update-object
(fn [objects id shape]
(if (and (cfh/image-shape? shape)
(nil? (:metadata shape)))
(-> objects
(dissoc id)
(d/update-in-when [(:parent-id shape) :shapes]
(fn [shapes] (filterv #(not= id %) shapes))))
objects))
update-page
(fn [page]
(d/update-when page :objects #(reduce-kv update-object % %)))]
(-> file-data
(update :pages-index update-vals update-page)
(update :components update-vals update-page))))
fix-misc-shape-issues
(fn [file-data]
;; Find shapes that are not listed in their parent's children list.
@ -388,6 +409,7 @@
(-> file-data
(fix-misc-shape-issues)
(fix-recent-colors)
(fix-missing-image-metadata)
(fix-orphan-shapes)
(remove-nested-roots)
(add-not-nested-roots)