Skip to content

Commit 8a80d2c

Browse files
authored
[🐛][Select]: fix get options utility (#101)
* Update version * Fix get options utility * Pass `true` value as `isInList` param to get options utility
1 parent f0f3c5a commit 8a80d2c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

lib/Select/components/Group.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ const GroupBase = (props: Props, ref: React.Ref<HTMLDivElement>) => {
8787
React.Children.toArray(
8888
resolvePropWithRenderContext(childrenProp, { hidden: false }),
8989
),
90+
true,
9091
);
9192

9293
hidden = options.every(
93-
option => !filtered.some(entity => entity === option.value),
94+
option => !filtered.some(value => value === option.value),
9495
);
9596
}
9697
}

lib/Select/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ export const noValueSelected = (value: string | string[] | undefined) =>
2626

2727
export const getOptions = (
2828
childArray: Array<Exclude<React.ReactNode, boolean | null | undefined>>,
29+
isInList = false,
2930
) => {
30-
let isListFound = false;
31+
let isListFound = isInList;
3132

3233
const recurse = (
3334
childArray: Array<Exclude<React.ReactNode, boolean | null | undefined>>,
34-
isInList = false,
35+
isInList: boolean,
3536
): Array<
3637
PickAsMandatory<OptionProps, "disabled" | "value" | "valueLabel">
3738
> => {
@@ -92,7 +93,7 @@ export const getOptions = (
9293
);
9394
};
9495

95-
return recurse(childArray);
96+
return recurse(childArray, isInList);
9697
};
9798

9899
type Registry<Key extends string> = Map<Key, string>;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@styleless-ui/react",
3-
"version": "1.0.0-rc.8",
3+
"version": "1.0.0-rc.9",
44
"description": "Completely unstyled, headless and accessible React UI components.",
55
"author": "mimshins <mostafa.sh.coderino@gmail.com>",
66
"license": "MIT",

0 commit comments

Comments
 (0)