🐛 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
This commit is contained in:
Eva Marco 2026-10-07 16:53:42 +02:00 committed by Alonso Torres
parent 11bf8d1f67
commit dc6fc46a36
2 changed files with 13 additions and 3 deletions

View File

@ -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)

View File

@ -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)))))))