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: SingleComboBoxの内部ロジックを整理する #5337

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

AtsushiM
Copy link
Member

関連URL

概要

変更内容

確認方法

@@ -59,42 +59,37 @@ const ListBoxItemButton = <T,>({
const buttonStyle = useMemo(
() =>
button({
active: !!isActive,
active: isActive,
Copy link
Member Author

Choose a reason for hiding this comment

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

isActiveは常にbooleanなので !!でboolean化する必要はありません

{label}
</button>
)
}

const MemoizedNewIconWithText = React.memo<{ label: ReactNode }>(({ label }) => (
<FaPlusCircleIcon color="TEXT_LINK" text={<Text color="TEXT_LINK">「{label}」を追加</Text>} />
Copy link
Member Author

Choose a reason for hiding this comment

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

Icon自体はmemo化されていますが、textにReact.Componentが渡されれば毎回再レンダリングされてしまいます。
幸いlabelが切り替わる可能性がないため、Icon毎Textを含めた状態でmemo化するようにしました

@yagimushi yagimushi force-pushed the chore-refactoring-SingleComboBox branch 2 times, most recently from 833cfa2 to 15701b3 Compare January 27, 2025 04:58
Copy link

pkg-pr-new bot commented Jan 27, 2025

Open in Stackblitz

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

commit: 549eec5

@yagimushi yagimushi force-pushed the chore-refactoring-SingleComboBox branch from 15701b3 to 549eec5 Compare January 27, 2025 06:56
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