Skip to content

Commit

Permalink
chore: ActionDialogの早期returnを調整する
Browse files Browse the repository at this point in the history
  • Loading branch information
AtsushiM committed Jan 23, 2025
1 parent c6f4417 commit 703c0e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const ActionDialog: React.FC<Props & ElementProps> = ({
onClickClose,
onPressEscape = onClickClose,
responseMessage,
actionDisabled = false,
actionDisabled,
closeDisabled,
subActionArea,
className,
Expand All @@ -37,17 +37,15 @@ export const ActionDialog: React.FC<Props & ElementProps> = ({
const titleId = useId()

const handleClickClose = useCallback(() => {
if (!props.isOpen) {
return
if (props.isOpen) {
onClickClose()
}
onClickClose()
}, [onClickClose, props.isOpen])

const handleClickAction = useCallback(() => {
if (!props.isOpen) {
return
if (props.isOpen) {
onClickAction(onClickClose)
}
onClickAction(onClickClose)
}, [onClickAction, onClickClose, props.isOpen])

return createPortal(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import React, { type FC, type PropsWithChildren, type ReactNode, useCallback } from 'react'
import React, { type FC, type PropsWithChildren, type ReactNode, useCallback, useMemo } from 'react'

import { Button } from '../../Button'
import { Cluster, Stack } from '../../Layout'
Expand Down Expand Up @@ -133,7 +133,7 @@ export const ActionDialogContentInner: FC<ActionDialogContentInnerProps> = ({

const ActionAreaCluster = React.memo<
Pick<
FormDialogContentInnerProps,
ActionDialogContentInnerProps,
| 'onClickClose'
| 'onClickAction'
| 'closeDisabled'
Expand Down

0 comments on commit 703c0e3

Please sign in to comment.