antvis / antvis/G6

[Bug]: Cannot read properties of null (reading '0')

Open
#7,583 4 comments 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 / 问题描述

drag节点的时候报错
```
Uncaught (in promise) TypeError: Cannot read properties of null (reading '0')
at AABB2.setFromTransformedAABB (@antv_g6.js?v=70d37b7b:22435:19)
at DefaultSceneGraphService2.getLocalBounds (@antv_g6.js?v=70d37b7b:31263:23)
at Circle4.getLocalBounds (@antv_g6.js?v=70d37b7b:32530:40)
at _Circle.getLabelStyle (@antv_g6.js?v=70d37b7b:51900:44)
at _Circle.drawLabelShape (@antv_g6.js?v=70d37b7b:52017:24)
at _Circle.render (@antv_g6.js?v=70d37b7b:52031:10)
at _Circle.update (@antv_g6.js?v=70d37b7b:51342:10)
at _Circle.update (@antv_g6.js?v=70d37b7b:52035:11)
at updateStyle (@antv_g6.js?v=70d37b7b:56508:11)
at Object.before (@antv_g6.js?v=70d37b7b:89572:11)
at @antv_g6.js?v=70d37b7b:88057:107
at Array.map ()
at Animation2.animate (@antv_g6.js?v=70d37b7b:88053:40)
at ElementController.setAnimationTask (@antv_g6.js?v=70d37b7b:89433:35)
at ElementController.draw (@antv_g6.js?v=70d37b7b:89413:17)
at _Graph. (@antv_g6.js?v=70d37b7b:91507:41)
at Generator.next ()
at fulfilled (@antv_g6.js?v=70d37b7b:90585:25)
```
浏览器显示对应的代码为
```
}, {
key: "setFromTransformedAABB",
value: function setFromTransformedAABB(aabb, m2) {
var bc = this.center;
var br = this.halfExtents;
var ac = aabb.center;
var ar = aabb.halfExtents;
var mx0 = m2[0];//此处报错
```

背景:当前项目在不复杂的图上没遇到过这个问题,这个问题发生在一个数据量相对大(几十上百)的情况下
由于当前项目存在比较多的处理流程,我无法判断这个问题产生的原因并分离出复现demo
代码中应当不涉及自定义节点绘制
报错代码在我的项目中发生在调用graph.draw函数时

希望能解释一下此处代码的行为,并提供后续排查线索

### Reproduction link / 复现链接

_No response_

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

_No response_

### Version / 版本

🆕 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 at graph.draw and the setFromTransformedAABB stack location shown in the report; compare a small graph with the larger data set and capture which state supplies the null matrix. Done means producing a minimal reproduction or identifying a concrete cause, then verifying a fix with regression coverage.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.