diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index f9861c6eb8..da7075ecb0 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -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)) diff --git a/common/src/app/common/files/repair.cljc b/common/src/app/common/files/repair.cljc index 941f43ac46..29e6d4fdf5 100644 --- a/common/src/app/common/files/repair.cljc +++ b/common/src/app/common/files/repair.cljc @@ -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)