From dc6fc46a364bc9d202e6683bf67405b2eb672515 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 7 Oct 2026 16:53:42 +0200 Subject: [PATCH] :bug: Refresh X/Y inputs when a flex child toggles absolute position The measures menu is memoized and only re-renders when one of the compared values changes. :layout-item-absolute was not among them, so switching a flex child between static and absolute kept the X/Y inputs in their previous disabled/enabled state until another compared value changed or the shape was selected again. AI-assisted-by: claude-opus-5-5 --- .../ui/workspace/sidebar/options/menus/measures.cljs | 7 +++++-- .../test/frontend_tests/ui/measures_menu_props_test.cljs | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 7b1b258a2c..7d08ed806c 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -50,10 +50,11 @@ :show-content :hide-in-viewer - ;; Needed to disable/enable width/height + ;; Needed to disable/enable width/height and x/y ;; otherwise the memo will not detect changes :layout-item-h-sizing - :layout-item-v-sizing]) + :layout-item-v-sizing + :layout-item-absolute]) (def ^:private generic-options #{:size :position :rotation}) @@ -161,6 +162,8 @@ (get n-values :layout-item-h-sizing)) (identical? (get o-values :layout-item-v-sizing) (get n-values :layout-item-v-sizing)) + (identical? (get o-values :layout-item-absolute) + (get n-values :layout-item-absolute)) (identical? (get o-values :points) (get n-values :points)) (identical? (get o-values :selrect) diff --git a/frontend/test/frontend_tests/ui/measures_menu_props_test.cljs b/frontend/test/frontend_tests/ui/measures_menu_props_test.cljs index e4a7b81903..0f509d3a08 100644 --- a/frontend/test/frontend_tests/ui/measures_menu_props_test.cljs +++ b/frontend/test/frontend_tests/ui/measures_menu_props_test.cljs @@ -48,4 +48,11 @@ (t/testing "re-renders when width changes" (t/is (false? (check-measures-menu-props (props base-values) - (props (assoc base-values :width 150))))))) + (props (assoc base-values :width 150)))))) + + (t/testing "re-renders when absolute positioning changes but nothing else does" + ;; Regression test: toggling static <-> absolute on a flex child must + ;; force a re-render so the X/Y inputs enabled/disabled state updates. + (t/is (false? (check-measures-menu-props + (props (assoc base-values :layout-item-absolute false)) + (props (assoc base-values :layout-item-absolute true)))))))