mirror of
https://github.com/penpot/penpot.git
synced 2025-02-12 18:18:24 -05:00
Merge pull request #3832 from penpot/superalex-fix-child-not-found
🐛 Fix repair for child not found situations
This commit is contained in:
commit
65aeda1dab
2 changed files with 6 additions and 12 deletions
|
@ -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 _]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue