Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: AccordionPanelの内部処理を整理 #5360

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

AtsushiM
Copy link
Member

@AtsushiM AtsushiM commented Feb 3, 2025

関連URL

概要

変更内容

確認方法

Copy link

pkg-pr-new bot commented Feb 3, 2025

Open in Stackblitz

npm i https://pkg.pr.new/kufu/smarthr-ui@5360

commit: c9aa384

@yagimushi yagimushi force-pushed the chore-refactoring-AccordionPanel branch from ff2d85d to c9aa384 Compare February 13, 2025 00:17
Comment on lines +115 to +130
const handleClick = useMemo(() => {
if (actualOnClickTrigger) {
if (actualOnClickProps) {
return (e: React.MouseEvent<HTMLButtonElement>) => {
actualOnClickTrigger(e)
actualOnClickProps(e)
}
}

if (onClickProps) {
const newExpandedItems = getNewExpandedItems(
expandedItems,
name,
!isExpanded,
expandableMultiply,
)
onClickProps(mapToKeyArray(newExpandedItems))
return actualOnClickTrigger
} else if (actualOnClickProps) {
return actualOnClickProps
}
}, [onClickTrigger, name, isExpanded, onClickProps, expandedItems, expandableMultiply])

return undefined
}, [actualOnClickProps, actualOnClickTrigger])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clickする度に無駄な呼び出しと判定が行われる可能性があったため、すべて事前にチェックするように修正しています

@AtsushiM AtsushiM marked this pull request as ready for review February 13, 2025 00:20
@AtsushiM AtsushiM requested a review from a team as a code owner February 13, 2025 00:20
@AtsushiM AtsushiM requested review from yt-ymmt and nabeliwo and removed request for a team February 13, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant