Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<!-- markdownlint-configure-file { "no-duplicate-heading": { "siblings_only": true } } -->

<!-- markdownlint-disable-next-line first-line-h1 -->
## Unreleased

### Fixed

* `DictSelect` now generates empty option only if initial value does not match any of provided options

## 0.1.0 - 2025-09-17

### Added
Expand Down
3 changes: 2 additions & 1 deletion src/select/dict_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ pub fn DictSelect<T: Clone + From<String> + PartialEq + ToString + 'static>(
value.set(new_value.parse().unwrap_or_default());
});

// Generate empty option only if initial value does not match any of provided options
let empty = computed_tuple!(value, options).render_value_option(|(value, options)| {
options
.iter()
.any(|(key, _)| key != &value)
.all(|(key, _)| key != &value)
.then(|| dom! { <option value="" selected="selected" /> })
});

Expand Down
Loading