Delimit rendering of components when they are visible on workspace assets tab

This commit is contained in:
Andrey Antukh 2023-08-29 17:17:26 +02:00
parent 1e2603f1f5
commit 8a4fcc1d10

View file

@ -25,6 +25,7 @@
[app.main.ui.components.file-uploader :refer [file-uploader]] [app.main.ui.components.file-uploader :refer [file-uploader]]
[app.main.ui.components.radio-buttons :refer [radio-button radio-buttons]] [app.main.ui.components.radio-buttons :refer [radio-button radio-buttons]]
[app.main.ui.context :as ctx] [app.main.ui.context :as ctx]
[app.main.ui.hooks :as h]
[app.main.ui.icons :as i] [app.main.ui.icons :as i]
[app.main.ui.workspace.sidebar.assets.common :as cmm] [app.main.ui.workspace.sidebar.assets.common :as cmm]
[app.main.ui.workspace.sidebar.assets.groups :as grp] [app.main.ui.workspace.sidebar.assets.groups :as grp]
@ -65,6 +66,8 @@
new-css-system (mf/use-ctx ctx/new-css-system) new-css-system (mf/use-ctx ctx/new-css-system)
component-id (:id component) component-id (:id component)
visible? (h/use-visible item-ref :once? true)
;; NOTE: we don't use reactive deref for it because we don't ;; NOTE: we don't use reactive deref for it because we don't
;; really need rerender on any change on the file change. If ;; really need rerender on any change on the file change. If
;; the component changes, it will trigger rerender anyway. ;; the component changes, it will trigger rerender anyway.
@ -180,8 +183,9 @@
(when (and (some? root-shape) (when (and (some? root-shape)
(some? container)) (some? container))
[:* [:*
[:& component-svg {:root-shape root-shape (when visible?
:objects (:objects container)}] [:& component-svg {:root-shape root-shape
:objects (:objects container)}])
(let [renaming? (= renaming (:id component))] (let [renaming? (= renaming (:id component))]
[:* [:*
[:& editable-label [:& editable-label