Skip to content

Conversation

@XiaoMing-xmg666
Copy link
Collaborator

@XiaoMing-xmg666 XiaoMing-xmg666 commented Oct 28, 2025

Fix #7362
Kapture 2025-10-28 at 13 57 32

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @XiaoMing-xmg666, 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 addresses a bug within the tooltip plugin where tooltips could remain visible even after the conditions for their display were no longer met. The update introduces a check within the tooltip's show method to explicitly hide the tooltip if its isEnable state evaluates to false, thereby ensuring correct and responsive tooltip behavior.

Highlights

  • Tooltip Visibility Fix: Implemented a fix to ensure tooltips are correctly hidden when they are no longer enabled, preventing them from lingering on the screen.
  • Improved User Experience: The change enhances the user experience by ensuring tooltips accurately reflect the current state of interactive elements.
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 addresses an issue where the tooltip would remain visible even when it should be disabled. The change correctly hides the tooltip when the isEnable condition is not met. However, I've identified a critical issue where the new logic could cause a runtime crash. This can happen when the tooltip is shown programmatically (e.g., via showById) because the event object would lack a client property, which the hide method expects. I've provided a code suggestion to prevent this potential crash.

if (!this.tooltipElement) return;
// if shown, when is not enable, hide
if (!this.isEnable(event, items)) {
this.hide(event);
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

Calling this.hide(event) here can cause a runtime error. The event object might not have a client property, for example when show() is called via showById(). The hide() method unconditionally destructures event.client, which will throw an exception if client is undefined.

To fix this, we can conditionally pass the event to hide() only when event.client exists. If it doesn't, calling hide() with undefined will trigger the safe path within the hide method that does not access the client property.

Suggested change
this.hide(event);
this.hide(event.client ? event : undefined);

@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.60%. Comparing base (6964895) to head (dbb9c9f).
⚠️ Report is 2 commits behind head on v5.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##               v5    #7462      +/-   ##
==========================================
+ Coverage   95.57%   95.60%   +0.03%     
==========================================
  Files         188      188              
  Lines        9871     9874       +3     
  Branches     2082     2131      +49     
==========================================
+ Hits         9434     9440       +6     
- Misses        402      434      +32     
+ Partials       35        0      -35     
Flag Coverage Δ
g6 95.60% <100.00%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
packages/g6/src/plugins/tooltip.ts 79.71% <100.00%> (+2.67%) ⬆️

... and 12 files 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 38b8d16 into v5 Oct 28, 2025
3 checks passed
@Aarebecca Aarebecca deleted the fix/xmg/tooltip--hide branch October 28, 2025 07:46
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.

[Bug]: tooltip在设置只有node才能触发的情况下,鼠标移出节点后移入combo内提示不消失

4 participants