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

♻️ Do a small performance refactor

This commit is contained in:
Andrés Moya 2021-10-19 12:27:41 +02:00 committed by Andrey Antukh
parent a4bbfe3c79
commit 1af4325e8f

View file

@ -347,14 +347,14 @@
in the map nor in the objects tree."
[interactions ids-map objects]
(when (some? interactions)
(->> interactions
(filterv (fn [interaction]
(let [destination (:destination interaction)]
(or (nil? destination)
(contains? ids-map destination)
(contains? objects destination)))))
(mapv (fn [interaction]
(d/update-when interaction :destination #(get ids-map % %)))))))
(let [xform (comp (filter (fn [interaction]
(let [destination (:destination interaction)]
(or (nil? destination)
(contains? ids-map destination)
(contains? objects destination)))))
(map (fn [interaction]
(d/update-when interaction :destination #(get ids-map % %)))))]
(into [] xform interactions))))
(defn actionable?
"Check if there is any interaction that is clickable by the user"