              :objects objects
              :key id}])))]))
 
+(defn- strip-objects
+  [objects]
+  (let [strip-data #(select-keys % [:id :name :blocked :hidden :shapes :type])]
+    (persistent!
+     (reduce-kv (fn [res id obj]
+                  (assoc! res id (strip-data obj)))
+                (transient {})
+                objects))))
+
+(mf/defc layers-tree-wrapper
+  {::mf/wrap-props false
+   ::mf/wrap [#(throttle % 200) mf/memo]}
+  [props]
+  (let [objects (obj/get props "objects")
+        objects (strip-objects objects)]
+    [:& layers-tree {:objects objects}]))
 
 ;; --- Layers Toolbox
-
-;; NOTE: we need to consider using something like react window for
-;; only render visible items instead of all.
 
 (mf/defc layers-toolbox
   {:wrap [mf/memo]}
   [{:keys [page] :as props}]
-  (let [locale (i18n/use-locale)
+  (let [locale   (mf/deref i18n/locale)
+        data     (mf/deref refs/workspace-data)
         on-click #(st/emit! (dw/toggle-layout-flag :layers))]
     [:div#layers.tool-window
      [:div.tool-window-bar

  [props]
  [:> layer-item props])

(def ^:private layers-objects
  (letfn [(strip-data [obj]
            (select-keys obj [:id :name :blocked :hidden :shapes :type]))
          (selector [{:keys [objects] :as data}]
            (persistent!
             (reduce-kv (fn [res id obj]
                          (assoc! res id (strip-data obj)))
                        (transient {})
                        objects)))]
  (l/derived selector refs/workspace-data =)))

(mf/defc layers-tree
  {::mf/wrap [mf/memo]}
  []
  (let [selected (mf/deref refs/selected-shapes)
        objects (mf/deref layers-objects)
        root (get objects uuid/zero)]
    ;; [:& perf/profiler {:label "layers-tree" :enabled false}
    [:ul.element-list
     (for [[index id] (reverse (d/enumerate (:shapes root)))]
       (let [obj (get objects id)]

   [uxbox.main.data.workspace :as dw]
   [uxbox.main.refs :as refs]
   [uxbox.main.store :as st]
   [uxbox.main.ui.components.defer :refer [throttle deferred]]
   [uxbox.main.ui.hooks :as hooks]
   [uxbox.main.ui.keyboard :as kbd]
   [uxbox.main.ui.shapes.icon :as icon]
   [uxbox.util.object :as obj]
   [uxbox.util.dom :as dom]
   [uxbox.util.timers :as ts]
   [uxbox.util.i18n :as i18n :refer [t]]
