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: add key for HighlightLabel #2588

Merged
merged 1 commit into from
Apr 14, 2023
Merged

chore: add key for HighlightLabel #2588

merged 1 commit into from
Apr 14, 2023

Conversation

winjo
Copy link
Contributor

@winjo winjo commented Apr 14, 2023

Types

  • Other Changes

Background or solution

🤖 Generated by Copilot at 725b38c

  • Add unique key props to span elements that render label text parts in HighlightLabel component (link, link, link)

image

Changelog

🤖 Generated by Copilot at 725b38c

Fixed React key warnings and improved performance in HighlightLabel component. Added key props to span elements in packages/quick-open/src/browser/components/highlight-label/index.tsx.

add key for HighlightLabel Component

@winjo winjo requested a review from Ricbet April 14, 2023 07:23
@github-actions
Copy link
Contributor

ChatGPT Code Review:

CodeReview:

这段代码没有明显的问题,只是增加了一个 key 属性来优化 React 列表项重排性能,这对于长列表会产生很大的性能提升。需要注意的是,每个 key 都应该是唯一的,但此处使用了子元素的下标和子字符串,可能会发生重复。因此,建议使用一个唯一的、能够标识该列表项的 ID。

修改建议:

建议将子元素 key 属性的值从 ${children.length}-${substring} 修改为 ${highlight.id}-${substring},其中 highlight.id 为能够标识该列表项的 ID。

Commit Message:

chore(highlight-label): add key for HighlightLabel

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (2feddcd) 57.63% compared to head (725b38c) 57.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2588      +/-   ##
==========================================
- Coverage   57.63%   57.62%   -0.01%     
==========================================
  Files        1326     1326              
  Lines       83559    83559              
  Branches    17402    17402              
==========================================
- Hits        48158    48154       -4     
- Misses      32162    32166       +4     
  Partials     3239     3239              
Flag Coverage Δ
jsdom 52.64% <ø> (-0.01%) ⬇️
node 16.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@winjo winjo merged commit d8f6806 into main Apr 14, 2023
14 checks passed
@winjo winjo deleted the chore/add-key-for-highlight branch April 14, 2023 08:27
@erha19 erha19 added this to the 2.24 milestone Apr 18, 2023
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.

None yet

3 participants