unional opened a new issue, #21084:
URL: https://github.com/apache/echarts/issues/21084
### Version
5.6.0
### Link to Minimal Reproduction
n/a see analysis below
### Steps to Reproduce
This is in intermittent issue.
When running Vitest (in Browser Mode with Playwright and Storybook),
we sometimes (20%) get this error:
```sh
Error: Failed to import test file /.../src/core/echarts.use.stories.tsx
Caused by: Error: axisPointer CartesianAxisPointer exists
```
The error is emitted from `AxisView.js`:
```js
AxisView.registerAxisPointerClass = function (type, clazz) {
if (process.env.NODE_ENV !== 'production') {
if (axisPointerClazz[type]) {
throw new Error('axisPointer ' + type + ' exists');
}
}
axisPointerClazz[type] = clazz;
};
```
After adding some trace, we can trace it to:
```sh
axisPointer CartesianAxisPointer registration
at
/node_modules/.cache/storybook/b95ed3f49b8894d3ea5fcdf88600fd77d9486425a594b17db16858440f31d993/sb-vitest/deps/echarts.js?v=d8a56d93:4357:1
axisPointer PolarAxisPointer registration
at
/node_modules/.cache/storybook/b95ed3f49b8894d3ea5fcdf88600fd77d9486425a594b17db16858440f31d993/sb-vitest/deps/echarts.js?v=d8a56d93:4358:1
axisPointer SingleAxisPointer registration
at
/node_modules/.cache/storybook/b95ed3f49b8894d3ea5fcdf88600fd77d9486425a594b17db16858440f31d993/sb-vitest/deps/echarts.js?v=d8a56d93:4360:1
axisPointer CartesianAxisPointer registration
at
/node_modules/.cache/storybook/b95ed3f49b8894d3ea5fcdf88600fd77d9486425a594b17db16858440f31d993/sb-vitest/deps/echarts.js?v=d8a56d93:4366:1
```
Which are:
```sh
// ../../node_modules/.pnpm/[email protected]/node_modules/echarts/index.js
use([install50]);
use([install49]);
use([install, install2, install3, install4, install5, install7, install8,
install9, install10, install11, install12, install14, install15, install16,
install17, install18, install19, install20, install21, install22, install23,
install24]);
use(install26); // line:4357
use(install27); // line:4358
use(install6);
use(install28); // line:4360
use(install13);
use(install29);
use(install30);
use(install31);
use(install32);
use(install25); // line:4366
use(install33);
use(install34);
```
Which are these lines in `echarts/index.js`:
```js
use([LineChart, BarChart, PieChart, ScatterChart, RadarChart, MapChart,
TreeChart, TreemapChart, GraphChart, GaugeChart, FunnelChart, ParallelChart,
SankeyChart, BoxplotChart, CandlestickChart, EffectScatterChart, LinesChart,
HeatmapChart, PictorialBarChart, ThemeRiverChart, SunburstChart, CustomChart]);
use(GridComponent); // this line
use(PolarComponent); // this line
use(GeoComponent);
use(SingleAxisComponent); // this line
...
use(AxisPointerComponent); // this line
```
The `GridComponent` is:
```js
// echarts/lib/component/grid/install.js
export function install(registers) {
use(installSimple);
use(installAxisPointer);
}
```
Where `installAxisPointer` is the same as `AxisPointerComponent`:
```js
// echarts/lib/component/axisPointer/install.js
export function install(registers) {
// CartesianAxisPointer is not supposed to be required here. But consider
// echarts.simple.js and online build tooltip, which only require
gridSimple,
// CartesianAxisPointer should be able to required somewhere.
AxisView.registerAxisPointerClass('CartesianAxisPointer',
CartesianAxisPointer);
...
```
Thus the error.
### Current Behavior
throw error
### Expected Behavior
should not throw
### Environment
```markdown
- OS: macOS Sequoia
- Browser: Chromium
- Framework: Vitest, Playwright, Storybook
```
### Any additional comments?
Not sure why it doesn't fail every single time. Based on the trace it should.
When it is not throwing, we observed that the last message was not emitted:
```
/node_modules/.cache/storybook/b95ed3f49b8894d3ea5fcdf88600fd77d9486425a594b17db16858440f31d993/sb-vitest/deps/echarts.js?v=d8a56d93:4366:1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]