From f7062e1cb1bc51d648277b682c6391c3db19c33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Queir=C3=B3s?= Date: Wed, 20 Sep 2023 23:52:50 -0300 Subject: [PATCH] [core] Fix element id inconsistencies in Select and Combobox.Option --- .../ComboboxOption/ComboboxOption.tsx | 10 +++++----- .../src/components/Select/Select.tsx | 20 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mantine-core/src/components/Combobox/ComboboxOption/ComboboxOption.tsx b/src/mantine-core/src/components/Combobox/ComboboxOption/ComboboxOption.tsx index dbd0377d56d..3af0e6075a2 100644 --- a/src/mantine-core/src/components/Combobox/ComboboxOption/ComboboxOption.tsx +++ b/src/mantine-core/src/components/Combobox/ComboboxOption/ComboboxOption.tsx @@ -1,12 +1,13 @@ -import React, { useId } from 'react'; +import { useId } from '@mantine/hooks'; +import React from 'react'; import { Box, BoxProps, CompoundStylesApiProps, - factory, ElementProps, - useProps, Factory, + factory, + useProps, } from '../../../core'; import { useComboboxContext } from '../Combobox.context'; import classes from '../Combobox.module.css'; @@ -58,8 +59,7 @@ export const ComboboxOption = factory((_props, ref) => { } = props; const ctx = useComboboxContext(); - const uuid = useId(); - const _id = id || uuid; + const _id = useId(id); return ( ((_props, ref) => { const parsedData = getParsedComboboxData(data); const optionsLockup = getOptionsLockup(parsedData); - const _id = useId(); + const _id = useId(id); const [_value, setValue] = useUncontrolled({ value,