Skip to content

Commit 43b32bf

Browse files
committed
fix: review comments
1 parent 622b5cb commit 43b32bf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Shared/Components/ConfirmationModal/ConfirmationModal.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { ButtonHTMLAttributes, ChangeEvent, cloneElement, useCallback, useEffect
1818
import { AnimatePresence, motion } from 'framer-motion'
1919
import { CustomInput, noop, stopPropagation, useRegisterShortcut, UseRegisterShortcutProvider } from '@Common/index'
2020
import { ComponentSizeType } from '@Shared/constants'
21+
import { getUniqueId } from '@Shared/Helpers'
2122
import { ConfirmationModalBodyProps, ConfirmationModalProps } from './types'
2223
import { getPrimaryButtonStyleFromVariant, getConfirmationLabel, getIconFromVariant } from './utils'
2324
import { Button, ButtonStyleType, ButtonVariantType } from '../Button'
@@ -187,12 +188,12 @@ const ConfirmationModal = (props: ConfirmationModalProps) => {
187188
const { setModalKey, settersRef } = useConfirmationModalContext()
188189

189190
useEffect(() => {
190-
const dateString = new Date().toISOString()
191-
setModalKey(dateString)
191+
const id = getUniqueId()
192+
setModalKey(id)
192193

193194
return () => {
194195
setModalKey((prev) => {
195-
if (prev === dateString) {
196+
if (prev === id) {
196197
return ''
197198
}
198199

@@ -203,7 +204,7 @@ const ConfirmationModal = (props: ConfirmationModalProps) => {
203204

204205
useEffect(() => {
205206
settersRef.current.setProps(props)
206-
})
207+
}, [props])
207208

208209
return null
209210
}

0 commit comments

Comments
 (0)