From 82f1b965036d9a03ce0a2289399f1d58d6b2de70 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 28 Aug 2023 15:56:41 +0200 Subject: [PATCH] :zap: Add micro optimization to `is-direct-child-of-root?` helper --- common/src/app/common/pages/helpers.cljc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/pages/helpers.cljc b/common/src/app/common/pages/helpers.cljc index 29a0e7437a..58124284d0 100644 --- a/common/src/app/common/pages/helpers.cljc +++ b/common/src/app/common/pages/helpers.cljc @@ -29,9 +29,10 @@ (defn is-direct-child-of-root? ([objects id] (is-direct-child-of-root? (get objects id))) - ([{:keys [frame-id type]}] - (and (= type :frame) - (= frame-id uuid/zero)))) + ([shape] + (and (some? shape) + (= (dm/get-prop shape :type) :frame) + (= (dm/get-prop shape :frame-id) uuid/zero)))) (defn frame-shape? ([objects id]