-
Notifications
You must be signed in to change notification settings - Fork 142
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: SegmentedControl, Radio系、ResponseMessageコンポーネントの内部処理を整理する #5385
base: master
Are you sure you want to change the base?
Conversation
commit: |
variants: { | ||
disabled: { | ||
true: { | ||
label: 'shr-cursor-[revert] shr-text-disabled', | ||
}, | ||
false: { | ||
label: 'shr-cursor-pointer', | ||
box: 'peer-hover:shr-shadow-input-hover', | ||
}, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disabledは頻繁に変更される可能性があるため、variantsではなく、元々styleに可変するものとして記述するようにしました
document.addEventListener('keydown', handleKeyDown) | ||
|
||
return () => { | ||
document.removeEventListener('keydown', handleKeyDown) | ||
} | ||
}, [handleKeyDown]) | ||
}, [isFocused]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleKeydownはuseEffec中でしか利用されていないため、統合しました
|
||
const excludesSelected = useMemo( | ||
() => !value || options.every((option) => option.value !== value), | ||
[options, value], | ||
[value, options], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
正しくmemo化されていれば、valueのほうが頻繁に変更されるため、依存関係チェックの優先度を入れ替えています
関連URL
概要
変更内容
確認方法