antvis / antvis/G6

[Bug]: Custom g2 node update exception drawing

Open
#6,724 1 comment 0 reactions 0 assignees View on GitHub
bug 🐛
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

使用了两种方法去更新自定义节点。

1. 使用updateData

使用此方法在连续两次给同一节点绘制时,edge路径异常、绘制的窗口也不会居中。

2. 使用删除(removeData)再添加(addData)

使用这个方法在每次更新只会执行删除或者添加二选一,此外当有多个添加的数据时绘制的窗口也不会居中。

![image](https://github.com/user-attachments/assets/24239782-cb12-48fb-bf06-a0f94e8eec4d)

![image](https://github.com/user-attachments/assets/9be2cdf2-958e-47db-bc6d-f4ceef94edab)

### Reproduction link / 复现链接

https://codesandbox.io/p/sandbox/silly-snowflake-7dp2mc

### Steps to Reproduce the Bug or Issue / 重现步骤

_No response_

### G6 Version / G6 版本

🆕 5.x

### OS / 操作系统

- [ ] macOS
- [X] Windows
- [ ] Linux
- [ ] Others / 其他

### Browser / 浏览器

- [X] Chrome
- [x] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked CodeSandbox reproduction and inspect the G6 5.x behavior for custom g2 nodes. Compare repeated updateData calls with removeData followed by addData, focusing on edge paths and whether the drawing window centers when multiple nodes are added. Done means both update approaches consistently render the expected edges and centered view.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.