🐛 Fix property input remains editable after keeping default property name (#7549)

* 🐛 Fix property input remains focused when keeping default property name

* 📎 PR changes
This commit is contained in:
Luis de Dios 2025-10-22 10:48:03 +02:00 committed by GitHub
parent 5e6af5aea9
commit e073b89604
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View File

@ -28,11 +28,7 @@
(pcb/update-component
changes (:id component)
(fn [component]
(d/update-in-when component [:variant-properties pos]
(fn [property]
(-> property
(assoc :name new-name)
(with-meta nil)))))
(d/update-in-when component [:variant-properties pos] #(assoc % :name new-name)))
{:apply-changes-local-library? true}))
changes
related-components)))

View File

@ -99,9 +99,25 @@
(defn update-property-name
"Update the variant property name on the position pos
in all the components with this variant-id"
in all the components with this variant-id and remove the focus"
[variant-id pos new-name {:keys [trigger]}]
(ptk/reify ::update-property-name
ptk/UpdateEvent
(update [_ state]
(let [file-id (:current-file-id state)
data (dsh/lookup-file-data state)
objects (dsh/lookup-page-objects state)
related-components (cfv/find-variant-components data objects variant-id)]
(reduce
(fn [s related-component]
(update-in s
[:files file-id :data :components (:id related-component) :variant-properties]
(fn [props] (mapv #(with-meta % nil) props))))
state
related-components)))
ptk/WatchEvent
(watch [it state _]
(let [page-id (:current-page-id state)