Skip to content

fix: 修复interaction内存在子视图时图元的获取#7134

Merged
sersishen merged 3 commits intov4.1.xfrom
fix/0917/viewsGetElement
Sep 18, 2025
Merged

fix: 修复interaction内存在子视图时图元的获取#7134
sersishen merged 3 commits intov4.1.xfrom
fix/0917/viewsGetElement

Conversation

@sersishen
Copy link
Copy Markdown
Collaborator

@sersishen sersishen commented Sep 17, 2025

Checklist
  • npm test passes
  • benchmarks are included
  • fix: 修复interaction内存在子视图时图元的获取
Description of change

@sersishen sersishen requested a review from hustcc September 17, 2025 09:28
Copy link
Copy Markdown
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.

Summary of Changes

Hello @sersishen, 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!

此 PR 主要修复了交互操作中子视图内的图元无法正确获取的问题。它通过增强 getElementsByState 工具函数,使其能够遍历嵌套视图,从而确保在交互过程中捕获所有相关的图形元素。此外,它还更新了 package.json 文件,为 D3 库添加了新的模块映射,这可能用于改进测试或构建配置。

Highlights

  • 修复交互中子视图图元获取问题: 修改了 getElementsByState 函数,使其在存在子视图时能够递归地获取图元,确保交互操作能正确识别嵌套视图中的元素。
  • 更新 Jest 模块映射: 为 package.json 添加了 d3-color, d3-interpolate, d3-geo, d3-pathmoduleNameMapper 条目,以优化 Jest 测试环境中的模块解析。
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
Copy Markdown
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

本次 PR 修复了 interaction 中无法获取子视图中图元的问题。通过在 getElementsByState 函数中添加递归逻辑来遍历子视图,确保能够正确获取所有相关图元,这与 getElements 函数的行为保持了一致,此修复方向正确且重要。我提供了一个关于性能优化的建议,在循环中用 push 代替 concat 来合并数组,以避免不必要的性能开销。此外,package.json 中的 moduleNameMapper 配置是为了解决 Jest 测试环境中 d3 模块的解析问题,属于常规的构建配置修复。

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@elvira1112 elvira1112 left a comment

Choose a reason for hiding this comment

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

+1

@sersishen sersishen merged commit f7d9e1f into v4.1.x Sep 18, 2025
1 of 5 checks passed
@sersishen sersishen deleted the fix/0917/viewsGetElement branch September 18, 2025 03:39
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