From d28d27b23e99ad3a378a25274a39e13fd037d5cb Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Mon, 28 Aug 2023 18:07:08 -0400 Subject: [PATCH] enhance: allow object to unset its class also fixes an issue where invalid uuids options were selecting the first option even though they weren't a match --- src/main/frontend/components/property.cljs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/frontend/components/property.cljs b/src/main/frontend/components/property.cljs index 108a6e4ab..5a7660758 100644 --- a/src/main/frontend/components/property.cljs +++ b/src/main/frontend/components/property.cljs @@ -49,17 +49,20 @@ :value id :selected (= class id)}) classes) - options' (if class - options - (cons + options' (cons + (if class + {:label "Choose a class" + :value ""} {:label "Choose a class" :disabled true :selected true - :value ""} - options))] + :value ""}) + options)] (ui/select options' (fn [_e value] - (swap! *property-schema assoc :class (uuid value)))))) + (if (seq value) + (swap! *property-schema assoc :class (uuid value)) + (swap! *property-schema dissoc :class)))))) (rum/defcs property-config < rum/reactive