mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix migration and repair for nil ids
This commit is contained in:
@@ -1775,7 +1775,7 @@
|
|||||||
(contains? component :objects))
|
(contains? component :objects))
|
||||||
(dissoc component :objects)
|
(dissoc component :objects)
|
||||||
component))]
|
component))]
|
||||||
(d/update-when data :components check-component)))
|
(d/update-when data :components d/update-vals check-component)))
|
||||||
|
|
||||||
(defmethod migrate-data "0018-sync-component-id-with-near-main"
|
(defmethod migrate-data "0018-sync-component-id-with-near-main"
|
||||||
[data _]
|
[data _]
|
||||||
@@ -1788,9 +1788,18 @@
|
|||||||
(if (and (some? ref-shape)
|
(if (and (some? ref-shape)
|
||||||
(or (not= (:component-id shape) (:component-id ref-shape))
|
(or (not= (:component-id shape) (:component-id ref-shape))
|
||||||
(not= (:component-file shape) (:component-file ref-shape))))
|
(not= (:component-file shape) (:component-file ref-shape))))
|
||||||
(assoc shape
|
(cond-> shape
|
||||||
:component-id (:component-id ref-shape)
|
(some? (:component-id ref-shape))
|
||||||
:component-file (:component-file ref-shape))
|
(assoc :component-id (:component-id ref-shape))
|
||||||
|
|
||||||
|
(nil? (:component-id ref-shape))
|
||||||
|
(dissoc :component-id)
|
||||||
|
|
||||||
|
(some? (:component-file ref-shape))
|
||||||
|
(assoc :component-file (:component-file ref-shape))
|
||||||
|
|
||||||
|
(nil? (:component-file ref-shape))
|
||||||
|
(dissoc :component-file))
|
||||||
shape))
|
shape))
|
||||||
shape))
|
shape))
|
||||||
|
|
||||||
@@ -1799,6 +1808,7 @@
|
|||||||
(-> data
|
(-> data
|
||||||
(update :pages-index d/update-vals update-page))))
|
(update :pages-index d/update-vals update-page))))
|
||||||
|
|
||||||
|
|
||||||
(def available-migrations
|
(def available-migrations
|
||||||
(into (d/ordered-set)
|
(into (d/ordered-set)
|
||||||
["legacy-2"
|
["legacy-2"
|
||||||
|
|||||||
@@ -340,9 +340,18 @@
|
|||||||
; Set the component-id and component-file to the ones of the near main
|
; Set the component-id and component-file to the ones of the near main
|
||||||
(log/debug :hint (str " -> set component-id to " (:component-id args)))
|
(log/debug :hint (str " -> set component-id to " (:component-id args)))
|
||||||
(log/debug :hint (str " -> set component-file to " (:component-file args)))
|
(log/debug :hint (str " -> set component-file to " (:component-file args)))
|
||||||
(assoc shape
|
(cond-> shape
|
||||||
:component-id (:component-id args)
|
(some? (:component-id args))
|
||||||
:component-file (:component-file args)))]
|
(assoc :component-id (:component-id args))
|
||||||
|
|
||||||
|
(nil? (:component-id args))
|
||||||
|
(dissoc :component-id)
|
||||||
|
|
||||||
|
(some? (:component-file args))
|
||||||
|
(assoc :component-file (:component-file args))
|
||||||
|
|
||||||
|
(nil? (:component-file args))
|
||||||
|
(dissoc :component-file)))]
|
||||||
|
|
||||||
(log/dbg :hint "repairing shape :component-id-mismatch" :id (:id shape) :name (:name shape) :page-id page-id)
|
(log/dbg :hint "repairing shape :component-id-mismatch" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||||
(-> (pcb/empty-changes nil page-id)
|
(-> (pcb/empty-changes nil page-id)
|
||||||
|
|||||||
Reference in New Issue
Block a user