0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -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." in the map nor in the objects tree."
[interactions ids-map objects] [interactions ids-map objects]
(when (some? interactions) (when (some? interactions)
(->> interactions (let [xform (comp (filter (fn [interaction]
(filterv (fn [interaction] (let [destination (:destination interaction)]
(let [destination (:destination interaction)] (or (nil? destination)
(or (nil? destination) (contains? ids-map destination)
(contains? ids-map destination) (contains? objects destination)))))
(contains? objects destination))))) (map (fn [interaction]
(mapv (fn [interaction] (d/update-when interaction :destination #(get ids-map % %)))))]
(d/update-when interaction :destination #(get ids-map % %))))))) (into [] xform interactions))))
(defn actionable? (defn actionable?
"Check if there is any interaction that is clickable by the user" "Check if there is any interaction that is clickable by the user"