Skip to content

Commit 0e0dd50

Browse files
hugues-mHugues Maignol
andauthored
feat: remove counter for generating modal id for compatibility with server component and client bundling with next app directory (#120)
Co-authored-by: Hugues Maignol <hugues@kime.tech>
1 parent 2f540a6 commit 0e0dd50

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Modal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ addModalTranslations({
198198

199199
export { addModalTranslations };
200200

201-
let counter = 0;
202-
203201
/** @see <https://react-dsfr-components.etalab.studio/?path=/docs/components-modal> */
204202
export function createModal<Name extends string>(params: {
205203
name: Name;
@@ -217,7 +215,7 @@ export function createModal<Name extends string>(params: {
217215
Record<`${Uncapitalize<Name>}ModalButtonProps`, ModalProps.ModalButtonProps> {
218216
const { name, isOpenedByDefault } = params;
219217

220-
const modalId = `${uncapitalize(name)}-modal-${counter++}`;
218+
const modalId = `${uncapitalize(name)}-modal`;
221219

222220
const modalNativeButtonProps = {
223221
"aria-controls": modalId,

0 commit comments

Comments
 (0)