Skip to content

Commit

Permalink
fix: close modal
Browse files Browse the repository at this point in the history
  • Loading branch information
PetromirDev committed Aug 7, 2024
1 parent f53943b commit a8eb558
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ const ExtensionInviteCodeModal = ({
const { addToast } = useToasts()
const [canClose, setCanClose] = useState(!waitForClose)

const onCloseModal = useCallback(() => {
const handleCloseModal = useCallback(() => {
if (!canClose) return
onHideModal()
setExtensionInviteCodeModalSeenBy((prev) => {
if (prev.includes(accountId)) return prev

return [...prev, accountId]
})
}, [accountId, onHideModal, setExtensionInviteCodeModalSeenBy])
}, [accountId, canClose, onHideModal, setExtensionInviteCodeModalSeenBy])

useEffect(() => {
const startingTime = Date.now()
Expand Down Expand Up @@ -66,7 +67,7 @@ const ExtensionInviteCodeModal = ({
className={cn(styles.closeIcon, {
[styles.closeIconEnabled]: canClose
})}
onClick={onCloseModal}
onClick={handleCloseModal}
/>
</div>
<div className={styles.content}>
Expand Down

0 comments on commit a8eb558

Please sign in to comment.