diff --git a/common/src/app/common/types/component.cljc b/common/src/app/common/types/component.cljc index 70b030eaf1..205454d713 100644 --- a/common/src/app/common/types/component.cljc +++ b/common/src/app/common/types/component.cljc @@ -240,3 +240,13 @@ (distinct) (filter #(not (eq % (get comp1 %) (get comp2 %)))) set))) + +(defn allow-duplicate? + [objects shape] + + (let [parent (get objects (:parent-id shape))] + ;; We don't want to change the structure of component copies + (and (not (in-component-copy-not-head? shape)) + ;; Non instance, non copy. We allow + (or (not (instance-head? shape)) + (not (in-component-copy? parent)))))) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 15d3d5ab45..eb5e9e168a 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -709,8 +709,8 @@ (let [page (wsh/lookup-page state) objects (:objects page) selected (->> (wsh/lookup-selected state) - (map #(get objects %)) - (remove #(ctk/in-component-copy-not-root? %)) ;; We don't want to change the structure of component copies + (map (d/getf objects)) + (filter #(ctk/allow-duplicate? objects %)) (map :id) set)] (when (seq selected)