Skip to content

Commit c1a3ce6

Browse files
committed
1 parent 6c68bd5 commit c1a3ce6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Select.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,19 @@ export const Select = memo(
5050

5151
const id = useAnalyticsId({
5252
"defaultIdPrefix": "fr-select-group",
53-
"explicitlyProvidedId": id_props ?? nativeSelectProps.id
53+
"explicitlyProvidedId": id_props
5454
});
5555

56-
const selectId = `select-${useId()}`;
56+
const selectId = (function useClosure() {
57+
const id = useId();
58+
59+
if (nativeSelectProps.id !== undefined) {
60+
return nativeSelectProps.id;
61+
}
62+
63+
return `select-${id}`;
64+
})();
65+
5766
const stateDescriptionId = `select-${useId()}-desc`;
5867

5968
return (

0 commit comments

Comments
 (0)