diff --git a/common/src/app/common/files/repair.cljc b/common/src/app/common/files/repair.cljc index 9e9fc29d4..c40b60227 100644 --- a/common/src/app/common/files/repair.cljc +++ b/common/src/app/common/files/repair.cljc @@ -473,29 +473,6 @@ (pcb/with-file-data file-data) (pcb/update-shapes [(:id shape)] repair-shape)))) -(defmethod repair-error :duplicate-slot - [_ {:keys [shape page-id] :as error} file-data _] - (let [page (ctpl/get-page file-data page-id) - childs (map #(get (:objects page) %) (:shapes shape)) - child-with-duplicate (let [result (reduce (fn [[seen duplicates] item] - (let [swap-slot (ctk/get-swap-slot item)] - (if (contains? seen swap-slot) - [seen (conj duplicates item)] - [(conj seen swap-slot) duplicates]))) - [#{} []] - childs)] - (second result)) - repair-shape - (fn [shape] - ;; Remove the swap slot - (log/debug :hint " -> remove swap-slot" :child-id (:id shape)) - (ctk/remove-swap-slot shape))] - - (log/dbg :hint "repairing shape :duplicated-slot" :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 (map :id child-with-duplicate) repair-shape)))) - (defmethod repair-error :missing-slot [_ {:keys [shape page-id args] :as error} file-data _] (let [repair-shape diff --git a/common/src/app/common/files/validate.cljc b/common/src/app/common/files/validate.cljc index cd4f3b43a..7caceed49 100644 --- a/common/src/app/common/files/validate.cljc +++ b/common/src/app/common/files/validate.cljc @@ -34,7 +34,6 @@ :component-not-main :component-main-external :component-not-found - :duplicate-slot :invalid-main-instance-id :invalid-main-instance-page :invalid-main-instance @@ -297,18 +296,6 @@ "This shape should not have swap slot" shape file page))) -(defn- check-duplicate-swap-slot - "Validate that the children of this shape does not have duplicated slots." - [shape file page] - (let [shapes (map #(get (:objects page) %) (:shapes shape)) - slots (->> (map #(ctk/get-swap-slot %) shapes) - (remove nil?)) - counts (frequencies slots)] - (when (some (fn [[_ count]] (> count 1)) counts) - (report-error :duplicate-slot - "This shape has children with the same swap slot" - shape file page)))) - (defn- check-shape-main-root-top "Root shape of a top main instance: @@ -321,7 +308,6 @@ (check-component-root shape file page) (check-component-not-ref shape file page) (check-empty-swap-slot shape file page) - (check-duplicate-swap-slot shape file page) (run! #(check-shape % file page libraries :context :main-top) (:shapes shape))) (defn- check-shape-main-root-nested @@ -349,7 +335,6 @@ (check-component-root shape file page) (check-component-ref shape file page libraries) (check-empty-swap-slot shape file page) - (check-duplicate-swap-slot shape file page) (run! #(check-shape % file page libraries :context :copy-top :library-exists library-exists) (:shapes shape)))) (defn- check-shape-copy-root-nested