mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 00:01:51 -05:00
🐛 Fix repair script for invalid-main-instance-page
This commit is contained in:
parent
349b6f6fce
commit
c2b470a4c6
2 changed files with 26 additions and 24 deletions
|
@ -191,7 +191,7 @@
|
||||||
(log/info :hint "Repairing shape :invalid-main-instance-page" :id (:id shape) :name (:name shape) :page-id page-id)
|
(log/info :hint "Repairing shape :invalid-main-instance-page" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||||
(-> (pcb/empty-changes nil page-id)
|
(-> (pcb/empty-changes nil page-id)
|
||||||
(pcb/with-library-data file-data)
|
(pcb/with-library-data file-data)
|
||||||
(pcb/update-component [(:component-id shape)] repair-component))))
|
(pcb/update-component (:component-id shape) repair-component))))
|
||||||
|
|
||||||
(defmethod repair-error :invalid-main-instance
|
(defmethod repair-error :invalid-main-instance
|
||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
|
|
|
@ -167,7 +167,8 @@
|
||||||
(let [components-v2 (dm/get-in file-data [:options :components-v2])]
|
(let [components-v2 (dm/get-in file-data [:options :components-v2])]
|
||||||
(if (and components-v2 (not (:deleted component)))
|
(if (and components-v2 (not (:deleted component)))
|
||||||
(let [component-page (get-component-page file-data component)]
|
(let [component-page (get-component-page file-data component)]
|
||||||
(ctn/get-shape component-page shape-id))
|
(when component-page
|
||||||
|
(ctn/get-shape component-page shape-id)))
|
||||||
(dm/get-in component [:objects shape-id]))))
|
(dm/get-in component [:objects shape-id]))))
|
||||||
|
|
||||||
(defn get-ref-shape
|
(defn get-ref-shape
|
||||||
|
@ -181,9 +182,10 @@
|
||||||
referenced by the instance shape."
|
referenced by the instance shape."
|
||||||
[file page libraries shape & {:keys [include-deleted?] :or {include-deleted? false}}]
|
[file page libraries shape & {:keys [include-deleted?] :or {include-deleted? false}}]
|
||||||
(let [root-shape (ctn/get-component-shape (:objects page) shape)
|
(let [root-shape (ctn/get-component-shape (:objects page) shape)
|
||||||
component-file (if (= (:component-file root-shape) (:id file))
|
component-file (when root-shape
|
||||||
|
(if (= (:component-file root-shape) (:id file))
|
||||||
file
|
file
|
||||||
(get libraries (:component-file root-shape)))
|
(get libraries (:component-file root-shape))))
|
||||||
component (when component-file
|
component (when component-file
|
||||||
(ctkl/get-component (:data component-file) (:component-id root-shape) include-deleted?))
|
(ctkl/get-component (:data component-file) (:component-id root-shape) include-deleted?))
|
||||||
ref-shape (when component
|
ref-shape (when component
|
||||||
|
|
Loading…
Add table
Reference in a new issue