Skip to content

Commit 835cccc

Browse files
committed
selectIdExplicitelyProvided in closure and check vs undefined
1 parent 5e13c9e commit 835cccc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Select.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ const SelectComponent = <T extends GenericOption<DefaultOptionValue>[]>(
6161
} = props;
6262

6363
assert<Equals<keyof typeof rest, never>>();
64-
const selectIdExplicitelyProvided = nativeSelectProps?.id;
6564
const { selectId, stateDescriptionId } = (function useClosure() {
65+
const selectIdExplicitelyProvided = nativeSelectProps?.id;
6666
const elementId = useId();
6767
const selectId = selectIdExplicitelyProvided ?? `select-${elementId}`;
68-
const stateDescriptionId = selectIdExplicitelyProvided
69-
? `${selectIdExplicitelyProvided}-desc`
70-
: `select-${elementId}-desc`;
68+
const stateDescriptionId =
69+
selectIdExplicitelyProvided !== undefined
70+
? `${selectIdExplicitelyProvided}-desc`
71+
: `select-${elementId}-desc`;
7172

7273
return { selectId, stateDescriptionId };
7374
})();

0 commit comments

Comments
 (0)