Skip to content

Commit

Permalink
Correctly show default-value c-select-input when missing on 1st render
Browse files Browse the repository at this point in the history
  • Loading branch information
madis committed Jan 13, 2025
1 parent c517d3b commit 44dcc87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ui/src/ethlance/ui/component/select_input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"Component has both controlled `selection` and uncontrolled `default-selection` attributes set.")
(let [value-fn (or value-fn identity)
label-fn (or label-fn identity)
current-selection (if (contains? opts :default-selection) @*current-default-selection selection)
opts (dissoc opts
:label :selections
:on-select :default-selection
Expand All @@ -75,8 +76,9 @@
:default-search-text
:size
:value-fn
:label-fn)
current-selection (if (contains? opts :default-selection) @*current-default-selection selection)]
:label-fn)]
(when (nil? @*current-default-selection)
(reset! *current-default-selection (or default-selection selection)))
[:div.ethlance-select-input (merge {:class [color-class size-class]} opts)
[:div.main
{:title (or (label-fn current-selection) label)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/ethlance/ui/page/sign_up.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
:error? (not (:candidate/rate form-validation))
:on-change #(>evt [:page.sign-up/set-candidate-rate (js/parseInt %)])}]]
[c-user-country-input
{:form-values form-values}]]
{:form-values (select-keys form-values [:user/country])}]]
[:div.second-forms
[c-user-languages-input
{:form-values form-values}]
Expand Down

0 comments on commit 44dcc87

Please sign in to comment.