Skip to content

Commit

Permalink
fix(plasma-new-hope): fix id generation for Modal, Popup
Browse files Browse the repository at this point in the history
  • Loading branch information
kayman233 committed Jan 25, 2024
1 parent 0ad715e commit 092a661
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/plasma-new-hope/src/components/Modal/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { forwardRef } from 'react';
import { useFocusTrap, useForkRef, useUniqId } from '@salutejs/plasma-core';
import { useFocusTrap, useForkRef, safeUseId } from '@salutejs/plasma-core';

import { RootProps, component } from '../../../engines';
import { popupConfig } from '../../Popup';
Expand Down Expand Up @@ -43,14 +43,14 @@ export const modalRoot = (Root: RootProps<HTMLDivElement, ModalProps>) =>

const innerRef = useForkRef<HTMLDivElement>(trapRef, outerRootRef);

const uniqId = useUniqId();
const uniqId = safeUseId();
const innerId = id || uniqId;

const { modalInfo } = useModal({ id: innerId, isOpen, closeOnEsc, onEscKeyDown, onClose, popupInfo });

return (
<Popup
id={id}
id={innerId}
isOpen={isOpen}
ref={innerRef}
popupInfo={modalInfo}
Expand Down
4 changes: 2 additions & 2 deletions packages/plasma-new-hope/src/components/Popup/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { forwardRef, useEffect, useRef, useState } from 'react';
import ReactDOM from 'react-dom';
import { useForkRef, useUniqId } from '@salutejs/plasma-core';
import { useForkRef, safeUseId } from '@salutejs/plasma-core';

import { RootProps } from '../../engines/types';
import { cx } from '../../utils';
Expand Down Expand Up @@ -101,7 +101,7 @@ export const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>
},
outerRootRef,
) => {
const uniqId = useUniqId();
const uniqId = safeUseId();
const innerId = id || uniqId;

const { isVisible, animationInfo, setVisible } = usePopup({
Expand Down

0 comments on commit 092a661

Please sign in to comment.