From 9923268589a35145c9e4f7155b47be2f5670af41 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 28 Apr 2022 13:12:31 +0200 Subject: [PATCH] :bug: Fix issue with paste ordering sometimes not being respected --- CHANGES.md | 1 + frontend/src/app/main/data/workspace.cljs | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 66e97cb2a..924826db3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -95,6 +95,7 @@ - Fix guides are not duplicated with the artboard [Taiga #3072](https://tree.taiga.io/project/penpot/issue/3072) - Fix problem when changing group size with decimal values [Taiga #3203](https://tree.taiga.io/project/penpot/issue/3203) - Fix error when drawing curves with only one point [Taiga #3282](https://tree.taiga.io/project/penpot/issue/3282) +- Fix issue with paste ordering sometimes not being respected [Taiga #3268](https://tree.taiga.io/project/penpot/issue/3268) ### :arrow_up: Deps updates ### :heart: Community contributions by (Thank you!) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 768ca5b2b..5a491eaf2 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1482,12 +1482,11 @@ (let [set-index (fn [[result index] id] [(assoc result id index) (inc index)]) - map-ids (when index - (->> (vals paste-objects) - (filter #(not (selected (:parent-id %)))) - (map :id) - (reduce set-index [{} (inc index)]) - first))] + map-ids + (->> selected + (map #(get-in paste-objects [% :id])) + (reduce set-index [{} (inc index)]) + first)] (if (and (= :add-obj (:type change)) (contains? map-ids (:old-id change))) (assoc change :index (get map-ids (:old-id change)))