fix: Java 管理页面点击列表项时 Tag 会闪烁#6256
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request optimizes the Java list rendering in JavaManagementPage by only updating the tags when the JavaRuntime item actually changes. The reviewer pointed out that using reference equality (oldItem != item) might still cause UI flickering when list items are reloaded as new instances, and suggested using !Objects.equals(oldItem, item) instead since JavaRuntime overrides equals based on the binary path.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| String vendor = JavaInfo.normalizeVendor(item.getVendor()); | ||
| if (vendor != null) | ||
| content.addTag(i18n("java.info.vendor") + ": " + vendor); | ||
| if (oldItem != item) { |
There was a problem hiding this comment.
在 JavaRuntime 中,equals 方法已被重写为基于 binary 路径进行比较。
当 Java 列表被刷新或重新加载时,可能会为相同的 Java 运行环境创建新的 JavaRuntime 实例。如果使用引用比较 oldItem != item,在刷新列表时,即使是同一个 Java 运行环境,由于实例引用不同,依然会触发 Tag 的清空和重新添加,从而导致闪烁。
建议使用 !Objects.equals(oldItem, item) 进行逻辑等值比较,这样可以更彻底地避免在刷新或重建实例时发生闪烁。
| if (oldItem != item) { | |
| if (!Objects.equals(oldItem, item)) { |
close #6049