mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 05:50:35 +00:00
🐛 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:
parent
11bf8d1f67
commit
dc6fc46a36
@ -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)
|
||||
|
||||
@ -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)))))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user