From 10fbae2f0a56a61017a648a69ad07a7619a44258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 8 Apr 2024 13:26:39 +0200 Subject: [PATCH 1/2] :bug: Fix error when pasting a main component in other file --- CHANGES.md | 1 + frontend/src/app/main/data/workspace.cljs | 1 - frontend/src/app/main/data/workspace/selection.cljs | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f80e972457..7482ad9c57 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -130,6 +130,7 @@ - Fix problem with hand tool stuck [Github #3318](https://github.com/penpot/penpot/issues/3318) - Fix problem with fix scrolling on nested elements [Github #3508](https://github.com/penpot/penpot/issues/3508) - Fix problem when changing typography assets [Github #3683](https://github.com/penpot/penpot/issues/3683) +- Internal error when you copy and paste some main components between files [Taiga #7397](https://tree.taiga.io/project/penpot/issue/7397) ## 1.19.5 diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 1dddf3f99a..a6487e3637 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -2041,7 +2041,6 @@ all-objects (merge page-objects objects) - drop-cell (when (ctl/grid-layout? all-objects parent-id) (gslg/get-drop-cell frame-id all-objects position)) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index acb0d21750..8ce2cfe1fa 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -512,9 +512,11 @@ (ctk/remove-swap-slot)) (dissoc :shapes - :main-instance :use-for-thumbnail) + (cond-> (not is-component-root?) + (dissoc :main-instance)) + (cond-> into-component? (dissoc :component-root)) From aed6a045b306883212dfe88c699eeceb328da765 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 8 Apr 2024 16:32:34 +0200 Subject: [PATCH 2/2] :bug: Fix problem with sort indexed shapes --- common/src/app/common/files/helpers.cljc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/helpers.cljc b/common/src/app/common/files/helpers.cljc index d6a15fcd4e..3856bc327b 100644 --- a/common/src/app/common/files/helpers.cljc +++ b/common/src/app/common/files/helpers.cljc @@ -540,7 +540,10 @@ filted by selected set" [objects selected] (let [selected (if (set? selected) selected (set selected))] - (sequence (map val) (indexed-shapes objects selected)))) + (sequence + (comp (filter (fn [o] (contains? selected (val o)))) + (map val)) + (indexed-shapes objects selected)))) (defn get-index-replacement "Given a collection of shapes, calculate their positions