diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/rect.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/rect.cljs index 545a7e9b7e..d2ddecc6d7 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/shapes/rect.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/shapes/rect.cljs @@ -23,44 +23,51 @@ [rumext.v2 :as mf])) (mf/defc options - {::mf/wrap [mf/memo]} - [{:keys [shape] :as props}] - (let [ids [(:id shape)] - type (:type shape) - measure-values (select-measure-keys shape) - layer-values (select-keys shape layer-attrs) - constraint-values (select-keys shape constraint-attrs) - fill-values (select-keys shape fill-attrs) - stroke-values (select-keys shape stroke-attrs) - layout-item-values (select-keys shape layout-item-attrs) - layout-container-values (select-keys shape layout-container-flex-attrs) + {::mf/wrap [mf/memo] + ::mf/wrap-props false} + [{:keys [shape]}] + (let [shape-id (:id shape) + ids (hooks/use-equal-memo [shape-id]) + type (:type shape) + measure-values (select-measure-keys shape) + layer-values (select-keys shape layer-attrs) + constraint-values (select-keys shape constraint-attrs) + fill-values (select-keys shape fill-attrs) + stroke-values (select-keys shape stroke-attrs) + layout-item-values (select-keys shape layout-item-attrs) + layout-container-values (select-keys shape layout-container-flex-attrs) - is-layout-child-ref (mf/use-memo (mf/deps ids) #(refs/is-layout-child? ids)) - is-layout-child? (mf/deref is-layout-child-ref) + is-layout-child* (mf/use-memo (mf/deps ids) #(refs/is-layout-child? ids)) + is-layout-child? (mf/deref is-layout-child*) - is-flex-parent-ref (mf/use-memo (mf/deps ids) #(refs/flex-layout-child? ids)) - is-flex-parent? (mf/deref is-flex-parent-ref) + is-flex-parent* (mf/use-memo (mf/deps ids) #(refs/flex-layout-child? ids)) + is-flex-parent? (mf/deref is-flex-parent*) + + is-grid-parent* (mf/use-memo (mf/deps ids) #(refs/grid-layout-child? ids)) + is-grid-parent? (mf/deref is-grid-parent*) - is-grid-parent-ref (mf/use-memo (mf/deps ids) #(refs/grid-layout-child? ids)) - is-grid-parent? (mf/deref is-grid-parent-ref) is-layout-child-absolute? (ctl/layout-absolute? shape) - ids (hooks/use-equal-memo ids) - parents-by-ids-ref (mf/use-memo (mf/deps ids) #(refs/parents-by-ids ids)) - parents (mf/deref parents-by-ids-ref)] + parents-by-ids* (mf/use-memo (mf/deps ids) #(refs/parents-by-ids ids)) + parents (mf/deref parents-by-ids*)] + [:* [:& measures-menu {:ids ids :type type :values measure-values :shape shape}] - [:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}] + [:& layout-container-menu + {:type type + :ids ids + :values layout-container-values + :multiple false}] (when (and (= (count ids) 1) is-layout-child? is-grid-parent?) [:& grid-cell/options {:shape (first parents) :cell (ctl/get-cell-by-shape-id (first parents) (first ids))}]) - (when is-layout-child? + (when ^boolean is-layout-child? [:& layout-item-menu {:ids ids :type type @@ -70,7 +77,8 @@ :is-grid-parent? is-grid-parent? :shape shape}]) - (when (or (not is-layout-child?) is-layout-child-absolute?) + (when (or (not ^boolean is-layout-child?) + ^boolean is-layout-child-absolute?) [:& constraints-menu {:ids ids :values constraint-values}])