🐛 Fix issue with paste ordering sometimes not being respected

This commit is contained in:
alonso.torres 2022-04-28 13:12:31 +02:00
parent a8103cbc3e
commit 9923268589
2 changed files with 6 additions and 6 deletions

View file

@ -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)))