We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fe37f51 + a4f96c0 commit 870b7c5Copy full SHA for 870b7c5
1 file changed
src/scripts/Picklist.tsx
@@ -67,8 +67,8 @@ function collectOptionValues(children: unknown): PicklistValue[] {
67
function findSelectedItemLabel(
68
children: unknown,
69
selectedValue: PicklistValue
70
-): React.ReactNode {
71
- return React.Children.map(children, (child) => {
+): React.ReactNode | null {
+ const selectedLabel = React.Children.map(children, (child) => {
72
if (!React.isValidElement(child)) {
73
return null;
74
}
@@ -118,6 +118,12 @@ function findSelectedItemLabel(
118
119
return labelValue || childrenValue;
120
});
121
+
122
+ if (Array.isArray(selectedLabel) && selectedLabel.length === 0) {
123
+ return null;
124
+ }
125
126
+ return selectedLabel;
127
128
129
/**
0 commit comments