0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

Improved performance to update layout

This commit is contained in:
alonso.torres 2024-05-22 17:22:47 +02:00 committed by Andrey Antukh
parent 47d7d24910
commit 9fcb4216b6

View file

@ -119,7 +119,14 @@
(->> stream
(rx/filter (ptk/type? :layout/update))
(rx/map deref)
(rx/map #(update-layout-positions %))
;; We buffer the updates to the layout so if there are many changes at the same time
;; they are process together. It will get a better performance.
(rx/buffer-time 100)
(rx/filter #(d/not-empty? %))
(rx/map
(fn [data]
(let [ids (reduce #(into %1 (:ids %2)) #{} data)]
(update-layout-positions {:ids ids}))))
(rx/take-until stopper))))))
(defn finalize