From 0d0c5ed96c8c1a13503223590faaf900e64168b7 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 25 Aug 2023 16:36:38 +0200 Subject: [PATCH] :zap: Add minor performance improvement to get-viewer-frames Reducing redundant lookups --- common/src/app/common/types/shape_tree.cljc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/app/common/types/shape_tree.cljc b/common/src/app/common/types/shape_tree.cljc index c5bc32dc19..a6455e5d93 100644 --- a/common/src/app/common/types/shape_tree.cljc +++ b/common/src/app/common/types/shape_tree.cljc @@ -320,12 +320,12 @@ (get-viewer-frames objects nil)) ([objects {:keys [all-frames?]}] - (into [] - (comp (map (d/getf objects)) - (if all-frames? - identity - (remove :hide-in-viewer))) - (sort-z-index objects (get-frames-ids objects))))) + (->> (get-frames objects) + (sort-z-index-objects objects) + (into [] + (if all-frames? + (map identity) + (remove :hide-in-viewer)))))) (defn start-page-index [objects]