Skip to content

Commit b3540b5

Browse files
authored
Fix #6822: Refactor Dropdown.js to improve optionLabel and optionValue retrieval (#6831)
* Fix #6822: Refactor Dropdown.js to improve optionLabel and optionValue retrieval * Refactor Dropdown.js to improve optionLabel and optionValue retrieval
1 parent 9163fd0 commit b3540b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/lib/dropdown/Dropdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,13 +886,13 @@ export const Dropdown = React.memo(
886886
};
887887

888888
const getOptionLabel = (option) => {
889-
const optionLabel = props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : ObjectUtils.resolveFieldData(option, 'label');
889+
const optionLabel = props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : option ? option['label'] : ObjectUtils.resolveFieldData(option, 'label');
890890

891891
return ObjectUtils.isNotEmpty(optionLabel) ? optionLabel : option;
892892
};
893893

894894
const getOptionValue = (option) => {
895-
const optionValue = props.OptionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : ObjectUtils.resolveFieldData(option, 'value');
895+
const optionValue = props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : option ? option['value'] : ObjectUtils.resolveFieldData(option, 'value');
896896

897897
return ObjectUtils.isNotEmpty(optionValue) ? optionValue : option;
898898
};

0 commit comments

Comments
 (0)