-
Notifications
You must be signed in to change notification settings - Fork 141
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: PageCounterの内部処理をリファクタリングする #5276
base: master
Are you sure you want to change the base?
Conversation
commit: |
@@ -25,40 +25,51 @@ const pageCounter = tv({ base: 'shr-text-base' }) | |||
export const PageCounter: React.FC<Props & ElementProps> = ({ | |||
start, | |||
end, | |||
total = 0, | |||
total, |
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.
初期化位置をtotalを表示するmemo化済みコンポーネントに移動しています
if (!decorators) { | ||
return { | ||
text: () => RANGE_SEPARATOR, | ||
visuallyHiddenText: () => RANGE_SEPARATOR_VISUALLY_HIDDEN_TEXT, | ||
} | ||
} |
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.
decoratorsの子要素分判定する無駄を省くため、先にdecorators自体のチェックを行うようにしています
<span>/</span> | ||
<BoldNumber>{children}</BoldNumber> | ||
</> | ||
), |
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.
Totalに関してはレンダリングされる可能性が低いため、memo化しています
関連URL
概要
変更内容
確認方法