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: useSectionWrapperのロジックを調整 #5411

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

Conversation

AtsushiM
Copy link
Member

関連URL

概要

変更内容

確認方法

Copy link

pkg-pr-new bot commented Feb 25, 2025

Open in Stackblitz

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

commit: d51fc61

@yagimushi yagimushi force-pushed the fix-useSectionWrapper branch 3 times, most recently from 224f80c to 5dc79a7 Compare February 25, 2025 07:08
@yagimushi yagimushi force-pushed the fix-useSectionWrapper branch from 5dc79a7 to d51fc61 Compare February 25, 2025 07:15
<Component {...props} ref={ref} className={styles} />
</Wrapper>
)
if (Wrapper) {
Copy link
Member Author

Choose a reason for hiding this comment

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

React.Fragmentの実行は単純なdivをレンダリングするより重いらしく、条件分岐することにしました。
元のロジックでは常になにか処理が必要な印象を受けてしまうので、 必要な場合のみ であることがわかるというメリットもあります

@@ -5,14 +5,15 @@ import { SectioningFragment } from './SectioningContent'

type ComponentType = string | React.ComponentType<any>

const sectioningContents = ['article', 'aside', 'nav', 'section']
const SECTIONING_CONTENTS_REGEX = /^(article|aside|nav|section)$/
Copy link
Member Author

Choose a reason for hiding this comment

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

配列をチェックするより、正規表現一発でやるほうが早いため切り替えました

@AtsushiM AtsushiM marked this pull request as ready for review February 25, 2025 23:11
@AtsushiM AtsushiM requested a review from a team as a code owner February 25, 2025 23:11
@AtsushiM AtsushiM requested review from oti and yuzuru-akiyama and removed request for a team February 25, 2025 23:11
Copy link
Contributor

@oti oti left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

2 participants