diff --git a/common/src/app/common/files/repair.cljc b/common/src/app/common/files/repair.cljc index c9f583a92..65ee79da4 100644 --- a/common/src/app/common/files/repair.cljc +++ b/common/src/app/common/files/repair.cljc @@ -68,16 +68,10 @@ (defmethod repair-error :child-not-found [_ {:keys [shape page-id args] :as error} file-data _] - (let [repair-shape - (fn [parent-shape] - ; Remove child shape from children list - (log/debug :hint " -> Remove child " :child-id (:child-id args)) - (update parent-shape :shapes (partial d/removev #(= % (:child-id args)))))] - - (log/info :hint "Repairing shape :child-not-found" :id (:id shape) :name (:name shape) :page-id page-id) - (-> (pcb/empty-changes nil page-id) - (pcb/with-file-data file-data) - (pcb/update-shapes [(:id shape)] repair-shape)))) + (log/info :hint "Repairing shape :child-not-found" :id (:id shape) :name (:name shape) :page-id page-id) + (-> (pcb/empty-changes nil page-id) + (pcb/with-file-data file-data) + (pcb/change-parent (:parent-id args) [shape] nil {:component-swap true}))) (defmethod repair-error :frame-not-found [_ {:keys [shape page-id] :as error} file-data _] diff --git a/common/src/app/common/files/validate.cljc b/common/src/app/common/files/validate.cljc index 537882e11..fb3782473 100644 --- a/common/src/app/common/files/validate.cljc +++ b/common/src/app/common/files/validate.cljc @@ -126,8 +126,8 @@ (when (or (nil? child) (not= (:parent-id child) (:id shape))) (report-error! :child-not-found (str/ffmt "Child % not found" child-id) - shape file page - :child-id child-id)))))))) + child file page + :parent-id (:id shape))))))))) (defn validate-frame! "Validate that the frame-id shape exists and is indeed a frame. Also