From 39a1d5cc89f2201e1428ad4f16f59a4da8013853 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 19 Mar 2025 12:42:05 +0100 Subject: [PATCH] :bug: Fix set unexpected deletion on reordering --- common/src/app/common/logic/tokens.cljc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/logic/tokens.cljc b/common/src/app/common/logic/tokens.cljc index 84f2c3b7fc..fb55a83f18 100644 --- a/common/src/app/common/logic/tokens.cljc +++ b/common/src/app/common/logic/tokens.cljc @@ -49,12 +49,20 @@ :or {collapsed-paths #{}}}] (let [tree (-> (ctob/get-set-tree tokens-lib) (ctob/walk-sets-tree-seq :skip-children-pred #(contains? collapsed-paths %))) + from (nth tree from-index) to (nth tree to-index) before (case position :top to - :bot (nth tree (inc to-index) nil) + :bot (let [v (nth tree (inc to-index) nil)] + ;; if the next index is a group, we need to set it as + ;; nil because if we set a path on different subpath, + ;; the move algorightm will simply remove the set + (if (:group? v) + nil + v)) :center nil) + prev-before (if (:group? from) (->> (drop (inc from-index) tree) (filter (fn [element]