Skip to content

fix: fix tree layout expand#7555

Merged
Aarebecca merged 5 commits intov5from
fix/tree-graph
Dec 25, 2025
Merged

fix: fix tree layout expand#7555
Aarebecca merged 5 commits intov5from
fix/tree-graph

Conversation

@Aarebecca
Copy link
Copy Markdown
Contributor

Relative PR: #7463
Relative Issues: #7447 #7439 #7325 #7283

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

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

This pull request focuses on refining the tree layout expansion and collapse functionality. It achieves this by updating the core @antv/hierarchy dependency, introducing a dedicated mechanism to synchronize layout results before node operations, and adjusting default behavior for alignment. These changes aim to improve the stability and visual correctness of hierarchical graph layouts, particularly during interactive collapse and expand actions.

Highlights

  • Dependency Update: The @antv/hierarchy dependency has been updated to version 0.7.1, bringing potential improvements or fixes from the hierarchy layout library.
  • Layout Synchronization Logic: A new private method syncLayoutResult has been introduced in ElementController to re-simulate the layout and update the model data before node collapse or expansion, ensuring layout consistency.
  • Node Collapse/Expand Behavior: The collapseNode and expandNode methods now utilize the new syncLayoutResult to ensure the layout is correctly calculated and applied, and the default align option for these operations has been changed from true to false when options are passed as a boolean.
  • Test Case and Snapshot Updates: The behavior-expand-collapse-node.ts test case has been adjusted with updated nodeSep and node style properties, and numerous SVG snapshot files have been modified to reflect the visual changes in the tree layout rendering.
  • Layout Simulation Flexibility: The simulate method in LayoutController now accepts optional layout options, allowing for more dynamic and specific layout configurations during simulation.
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

This pull request fixes issues related to tree layout expansion. The main changes include updating the @antv/hierarchy dependency, introducing a syncLayoutResult method to re-calculate layout before expanding/collapsing, and adjusting default behaviors. I've found a potential issue with stale position data being used in the expand animation and a significant reduction in test timeout that might affect CI stability. Overall, the changes are in the right direction to solve the layout problems.

Comment thread packages/g6/src/runtime/element.ts
Comment thread packages/g6/jest.config.js Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 25, 2025

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.53%. Comparing base (da3a8fe) to head (cef73f2).
⚠️ Report is 2 commits behind head on v5.

Files with missing lines Patch % Lines
packages/g6/src/runtime/element.ts 96.29% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##               v5    #7555      +/-   ##
==========================================
- Coverage   95.54%   95.53%   -0.01%     
==========================================
  Files         188      188              
  Lines        9914     9938      +24     
  Branches     2097     2103       +6     
==========================================
+ Hits         9472     9494      +22     
- Misses        410      412       +2     
  Partials       32       32              
Flag Coverage Δ
g6 95.53% <96.87%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
packages/g6/src/registry/build-in.ts 100.00% <ø> (ø)
packages/g6/src/runtime/graph.ts 97.44% <100.00%> (ø)
packages/g6/src/runtime/layout.ts 93.33% <100.00%> (ø)
packages/g6/src/runtime/element.ts 97.08% <96.29%> (-0.08%) ⬇️

... and 1 file with indirect coverage changes

🚀 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.

@Aarebecca Aarebecca merged commit b2d827f into v5 Dec 25, 2025
3 checks passed
@Aarebecca Aarebecca deleted the fix/tree-graph branch December 25, 2025 14:10
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.

3 participants