mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 04:19:08 -05:00
🐛 Fix parent not found, adding migration
This commit is contained in:
parent
6d73685f3a
commit
0fd6cacd17
3 changed files with 17 additions and 19 deletions
|
@ -667,23 +667,7 @@
|
||||||
:component-root)))]
|
:component-root)))]
|
||||||
(-> file-data
|
(-> file-data
|
||||||
(update :pages-index update-vals fix-container)
|
(update :pages-index update-vals fix-container)
|
||||||
(d/update-when :components update-vals fix-container))))
|
(d/update-when :components update-vals fix-container))))]
|
||||||
|
|
||||||
fix-shape-nil-parent-id
|
|
||||||
(fn [file-data]
|
|
||||||
;; Ensure that parent-id and frame-id are not nil
|
|
||||||
(letfn [(fix-container [container]
|
|
||||||
(d/update-when container :objects update-vals fix-shape))
|
|
||||||
|
|
||||||
(fix-shape [shape]
|
|
||||||
(let [frame-id (or (:frame-id shape)
|
|
||||||
uuid/zero)
|
|
||||||
parent-id (or (:parent-id shape)
|
|
||||||
frame-id)]
|
|
||||||
(assoc shape :frame-id frame-id
|
|
||||||
:parent-id parent-id)))]
|
|
||||||
(-> file-data
|
|
||||||
(update :pages-index update-vals fix-container))))]
|
|
||||||
|
|
||||||
(-> file-data
|
(-> file-data
|
||||||
(fix-file-data)
|
(fix-file-data)
|
||||||
|
@ -708,7 +692,6 @@
|
||||||
(fix-frame-ids)
|
(fix-frame-ids)
|
||||||
(fix-component-nil-objects)
|
(fix-component-nil-objects)
|
||||||
(fix-false-copies)
|
(fix-false-copies)
|
||||||
(fix-shape-nil-parent-id)
|
|
||||||
(fix-copies-of-detached)))) ; <- Do not add fixes after this one
|
(fix-copies-of-detached)))) ; <- Do not add fixes after this one
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
(ns app.common.files.defaults)
|
(ns app.common.files.defaults)
|
||||||
|
|
||||||
(def version 44)
|
(def version 45)
|
||||||
|
|
|
@ -843,3 +843,18 @@
|
||||||
(-> data
|
(-> data
|
||||||
(update :pages-index update-vals update-container)
|
(update :pages-index update-vals update-container)
|
||||||
(update :components update-vals update-container))))
|
(update :components update-vals update-container))))
|
||||||
|
|
||||||
|
(defmethod migrate 45
|
||||||
|
[data]
|
||||||
|
(letfn [(fix-shape [shape]
|
||||||
|
(let [frame-id (or (:frame-id shape)
|
||||||
|
uuid/zero)
|
||||||
|
parent-id (or (:parent-id shape)
|
||||||
|
frame-id)]
|
||||||
|
(assoc shape :frame-id frame-id
|
||||||
|
:parent-id parent-id)))
|
||||||
|
|
||||||
|
(update-container [container]
|
||||||
|
(d/update-when container :objects update-vals fix-shape))]
|
||||||
|
(-> data
|
||||||
|
(update :pages-index update-vals update-container))))
|
Loading…
Add table
Reference in a new issue