🐛 Fix migration and repair for nil ids

This commit is contained in:
Pablo Alba
2025-12-11 17:10:09 +01:00
committed by Andrés Moya
parent 8c89dc018e
commit e79aa0e5a9
2 changed files with 24 additions and 6 deletions

View File

@@ -1797,9 +1797,18 @@
(if (and (some? ref-shape)
(or (not= (:component-id shape) (:component-id ref-shape))
(not= (:component-file shape) (:component-file ref-shape))))
(assoc shape
:component-id (:component-id ref-shape)
:component-file (:component-file ref-shape))
(cond-> shape
(some? (:component-id 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))

View File

@@ -341,9 +341,18 @@
; 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-file to " (:component-file args)))
(assoc shape
:component-id (:component-id args)
:component-file (:component-file args)))]
(cond-> shape
(some? (:component-id 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)
(-> (pcb/empty-changes nil page-id)