From e073b896046cd9ad1b84e9a072261f9578b1c9c3 Mon Sep 17 00:00:00 2001 From: Luis de Dios Date: Wed, 22 Oct 2025 10:48:03 +0200 Subject: [PATCH] :bug: Fix property input remains editable after keeping default property name (#7549) * :bug: Fix property input remains focused when keeping default property name * :paperclip: PR changes --- .../app/common/logic/variant_properties.cljc | 6 +----- .../src/app/main/data/workspace/variants.cljs | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/common/src/app/common/logic/variant_properties.cljc b/common/src/app/common/logic/variant_properties.cljc index e2052a12c7..5c2fddd44a 100644 --- a/common/src/app/common/logic/variant_properties.cljc +++ b/common/src/app/common/logic/variant_properties.cljc @@ -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))) diff --git a/frontend/src/app/main/data/workspace/variants.cljs b/frontend/src/app/main/data/workspace/variants.cljs index acf32dc63c..2dc9358737 100644 --- a/frontend/src/app/main/data/workspace/variants.cljs +++ b/frontend/src/app/main/data/workspace/variants.cljs @@ -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)