Skip to content

Commit

Permalink
fix: flatOptions on Dropdown causing option group label blank (primef…
Browse files Browse the repository at this point in the history
…aces#7296)

* fix: flatOptions on Dropdown causing option group label blank

* remove: optionGroup. To determine if an option is a group, it is sufficient to use the group and optionGroupLabel properties
  • Loading branch information
marengga authored Oct 2, 2024
1 parent db99bda commit 06f6231
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const Dropdown = React.memo(

const flatOptions = (options) => {
return (options || []).reduce((result, option, index) => {
result.push({ optionGroup: option, group: true, index, code: option.code, label: option.label });
result.push({ ...option, group: true, index });

const optionGroupChildren = getOptionGroupChildren(option);

Expand Down Expand Up @@ -846,7 +846,7 @@ export const Dropdown = React.memo(
};

const isOptionGroup = (option) => {
return props.optionGroupLabel && option.optionGroup && option.group;
return props.optionGroupLabel && option.group;
};

const isOptionDisabled = (option) => {
Expand Down
2 changes: 1 addition & 1 deletion components/lib/dropdown/DropdownPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const DropdownPanel = React.memo(

style = { ...style, ...option.style };

if (option.group && option.optionGroup && props.optionGroupLabel) {
if (option.group && props.optionGroupLabel) {
const { optionGroupLabel } = props;
const groupContent = props.optionGroupTemplate ? ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : props.getOptionGroupLabel(option);
const key = index + '_' + props.getOptionGroupRenderKey(option);
Expand Down

0 comments on commit 06f6231

Please sign in to comment.