Skip to content

Commit 5f8cc49

Browse files
authored
Merge pull request #867 from data-driven-forms/pf3-select-label
fix(pf3): display placeholder for pre-selected lazy options.
2 parents 5a2e4c0 + f106f8b commit 5f8cc49

File tree

1 file changed

+6
-1
lines changed
  • packages/pf3-component-mapper/src/files/select

1 file changed

+6
-1
lines changed

packages/pf3-component-mapper/src/files/select/select.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ const getDropdownText = (value, placeholder, options) => {
5353
return [placeholder, true];
5454
}
5555

56-
return [options.find((option) => option.value === value).label, false];
56+
const selectedOption = options.find((option) => option.value === value);
57+
if (!selectedOption) {
58+
return [placeholder, true];
59+
}
60+
61+
return [selectedOption.label, false];
5762
};
5863

5964
class SearchInput extends Component {

0 commit comments

Comments
 (0)