apache / apache/echarts

[Bug] custom series NPE when removing element if transition animation is specified

Open
#18,402 1 comment 0 reactions 0 assignees View on GitHub
bug topic: custom
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.4.1

### Link to Minimal Reproduction

_No response_

### Steps to Reproduce

```html








remove


var option;

option = {
xAxis: {},
yAxis: {},
series: {
type: 'custom',
data: [[11, 22], [33, 44]],
renderItem: function (params, api) {
return {
type: 'rect',
transition: 'all',
enterFrom: {style: {opacity: 0}},
leaveTo: {style: {opacity: 0}},
x: 100,
y: 100,
shape: {
x: 0,
y: 0,
width: 100,
height: 100
},
style: {
fill: 'green',
opacity: 1
}
}
}
}
};

var dom = document.getElementById('main0');
var chart = echarts.init(dom);

var btnDom = document.getElementById('remove');
btnDom.onclick = function () {
var option2 = {
xAxis: {},
yAxis: {},
series: {
type: 'custom',
data: [],
renderItem: function (params, api) {
return {
type: 'rect',
transition: 'all',
enterFrom: {style: {opacity: 0}},
leaveTo: {style: {opacity: 0}},
x: 100,
y: 100,
shape: {
x: 0,
y: 0,
width: 100,
height: 100
},
style: {
fill: 'green'
}
}
}
}
};
chart.setOption(option2);
};

chart.setOption(option);

```

Click the button "remove",
See the browser console, NPE occurs.

### Current Behavior

NPE

### Expected Behavior

Working correctly.

### Environment

```markdown
- OS:
- Browser:
- Framework:
```

### Any additional comments?

https://github.com/apache/echarts/blob/c308ec76f20f5dadcd04d2a10eeee9e06fbdad81/src/chart/custom/CustomView.ts#L232

`customInnerStore(el).option` is never assigned

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.