Skip to content

Conversation

@Alexzjt
Copy link
Contributor

@Alexzjt Alexzjt commented Dec 10, 2025

👀 PR includes

✨ Feature

  • New feature

🎨 Enhance

  • Code style optimization
  • Refactoring
  • Change the UI
  • Improve the performance
  • Type optimization

🐛 Bugfix

🔧 Chore

  • Test case
  • Docs / demos update
  • CI / workflow
  • Release version
  • Other ()

📝 Description

selectedMeta的某个id是"root[&]四川省",那么通过startsWith匹配时,"root[&]四川省"和"root[&]四川省省"都会被匹配到,导致bug出现。我理解原作者这里通过startsWith这个函数的本意是"root[&]四川省"可以匹配 "root[&]四川省"、"root[&]四川省[&]成都市"、"root[&]四川省[&]雅安市"。

🖼️ Screenshot

Before After
iShot_2025-12-10_11 37 55 iShot_2025-12-10_11 36 11

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

@github-actions
Copy link
Contributor

你好 @Alexzjt,非常感谢你的贡献.
为了让代码更健壮, 请根据 贡献指南 补充相应单元测试 (文档改动或其他特殊场景除外), 如果有 API 改动, 请修改 相应的文档.
同时请检查 linttest 相关 CI 是否通过, 如果失败, 请点击 [Details] 按钮查看, 并根据日志修复.

Hello, @Alexzjt, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes.
At the same time, please check whether the CI related to lint and test passes. If the CI fails, please click [Details] button to check and repair according to the log.

@github-actions github-actions bot added next 2.0-next 版本的问题 pr(fix) bug fix labels Dec 10, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Alexzjt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在修复一个关键的复制功能缺陷,该缺陷导致在处理具有相似前缀的行或列ID时,数据选择和复制行为不准确。通过引入更精确的节点ID匹配策略,并为树形数据提供专门处理,确保了用户在复制表格数据时能够获得预期且正确的结果,从而提升了数据操作的可靠性。

Highlights

  • 修复复制逻辑: 解决了在复制数据时,由于节点ID前缀判断不准确导致的bug。
  • 精确匹配优化: 改进了 startsWith 匹配逻辑,确保只有完全匹配的节点或其直接子节点才会被选中,避免了“四川省”和“四川省省”这类相似前缀的误判。
  • 新增测试用例: 增加了新的单元测试,以验证在具有相同前缀的行ID情况下,复制功能能够正确工作。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new test case and a bug fix related to copying data in pivot tables. A new snapshot test should copy correct row in grid mode with same prefix was added to validate the copy behavior when row headers have similar prefixes. The core change is in the PivotDataCellCopy class, specifically in the getBrushSelectedRowOrColNodes method. The logic for filtering selected nodes has been refined to correctly identify row or column leaf nodes by either an exact ID match or by matching direct descendants using the NODE_ID_SEPARATOR, preventing incorrect matches that could occur with simple startsWith checks on similar prefixes. Additionally, a specific handling for isTreeData was introduced to filter nodes based on selected metadata IDs.

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.63%. Comparing base (ecdc9c8) to head (e57d45f).
⚠️ Report is 732 commits behind head on next.

Files with missing lines Patch % Lines
...core/src/utils/export/copy/pivot-data-cell-copy.ts 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3255      +/-   ##
==========================================
+ Coverage   75.77%   79.63%   +3.86%     
==========================================
  Files         257      217      -40     
  Lines       11994    12006      +12     
  Branches     2464     2692     +228     
==========================================
+ Hits         9088     9561     +473     
+ Misses       1398      817     -581     
- Partials     1508     1628     +120     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

Size Change: +60 B (+0.01%)

Total Size: 628 kB

Filename Size Change
./packages/s2-core/dist/s2-extends.min.js 158 kB +35 B (+0.02%)
./packages/s2-core/dist/s2.min.js 263 kB +25 B (+0.01%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/s2.min.css 581 B
./packages/s2-react-components/dist/s2-react-components.min.css 2.55 kB
./packages/s2-react-components/dist/s2-react-components.min.js 124 kB
./packages/s2-react/dist/s2-react.min.css 1.3 kB
./packages/s2-react/dist/s2-react.min.js 38.5 kB
./packages/s2-vue/dist/s2-vue.min.css 1.59 kB
./packages/s2-vue/dist/s2-vue.min.js 38.3 kB

compressed-size-action

@Alexzjt Alexzjt merged commit 171841d into next Dec 11, 2025
14 checks passed
@Alexzjt Alexzjt deleted the fix/dataCellCopy branch December 11, 2025 07:25
github-actions bot pushed a commit that referenced this pull request Dec 16, 2025
# [@antv/s2-v2.4.12-beta.1](https://github.com/antvis/S2/compare/@antv/s2-v2.4.11...@antv/s2-v2.4.12-beta.1) (2025-12-16)

### Bug Fixes

* 复制时相同前缀判断不准确 ([#3255](#3255)) ([171841d](171841d))

### Performance Improvements

* 性能优化合入 ([#3258](#3258)) ([c92af9f](c92af9f))
github-actions bot pushed a commit that referenced this pull request Dec 17, 2025
# [@antv/s2-v2.4.12-beta.1](https://github.com/antvis/S2/compare/@antv/s2-v2.4.11...@antv/s2-v2.4.12-beta.1) (2025-12-17)

### Bug Fixes

* 复制时相同前缀判断不准确 ([#3255](#3255)) ([171841d](171841d))

### Performance Improvements

* 性能优化合入 ([#3258](#3258)) ([c92af9f](c92af9f))
@lijinke666
Copy link
Member

🎉 This PR is included in version @antv/s2-v2.4.12-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member

🎉 This PR is included in version @antv/s2-v2.4.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛透视表维度文字有包含关系时复制出错

4 participants