0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

🐛 Fix components without root shape for v2 migration

This commit is contained in:
Alejandro Alonso 2024-02-09 12:25:47 +01:00 committed by Andrés Moya
parent 9f6b82dfc0
commit dc67056a8c

View file

@ -431,9 +431,11 @@
fix-empty-components fix-empty-components
(fn [file-data] (fn [file-data]
(letfn [(fix-component [components id component] (letfn [(fix-component [components id component]
(if (empty? (:objects component)) (let [root-shape (ctst/get-shape component (:id component))]
(if (or (empty? (:objects component))
(nil? root-shape))
(dissoc components id) (dissoc components id)
components))] components)))]
(-> file-data (-> file-data
(d/update-when :components #(reduce-kv fix-component % %))))) (d/update-when :components #(reduce-kv fix-component % %)))))