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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- The popover now uses the Dialog API behind the scenes

### Fixed

- Return early if `selected` is set as an empty string

## [0.7.2] - 2025-07-04

### Changed
Expand Down
2 changes: 1 addition & 1 deletion app/components/impulse/select_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(object_name, method_name, choices = [], selected: nil, **system_a
private

def value
return if @selected.nil?
return if @selected.blank?
return @selected.map { |value| find_option(value) }.compact if multiple?
find_option(@selected)
end
Expand Down
2 changes: 2 additions & 0 deletions test/components/select_component_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class SelectComponentTest < ApplicationTest
render_inline(Impulse::SelectComponent.new(:user, :fruit_id, ["Apple", "Guava"], selected: "Invalid"))
render_inline(Impulse::SelectComponent.new(:user, :fruit_id, ["Apple", "Guava"], selected: ["", "Apple"], multiple: true))
render_inline(Impulse::SelectComponent.new(:user, :fruit_id, ["Apple", "Guava"], selected: ["Invalid", "Apple"], multiple: true))
render_inline(Impulse::SelectComponent.new(:user, :fruit_id, ["Apple", "Guava"], selected: "", multiple: true))
render_inline(Impulse::SelectComponent.new(:user, :fruit_id, ["Apple", "Guava"], selected: nil, multiple: true))
end
end

Expand Down