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:
parent
47d7d24910
commit
9fcb4216b6
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue