Skip to content

[Bug] Cannot read properties of null (reading 'offsetWidth') when using notMerge #20335

@Curtis-Lockley

Description

@Curtis-Lockley

Version

5.5.1

Link to Minimal Reproduction

https://jsfiddle.net/az4p58gs/

Steps to Reproduce

All you need to do once opening to reproduce the bug is to scroll around and zoom in/out until the crash occurs.

Current Behavior

Currently, there is a chance that when scrolling for a crash to occur as shown below.
echarts-null-value

Below is the error message

echarts.min.js:45 Uncaught TypeError: Cannot read properties of null (reading 'offsetWidth')
    at t.getSize (echarts.min.js:45:781248)
    at e._updatePosition (echarts.min.js:45:792803)
    at e.<anonymous> (echarts.min.js:45:790188)
    at e._showOrMove (echarts.min.js:45:788953)
    at e._showAxisTooltip (echarts.min.js:45:790116)
    at e._tryShow (echarts.min.js:45:788458)
    at e.manuallyShowTip (echarts.min.js:45:787122)
    at echarts.min.js:45:786112

Expected Behavior

The intended behaviour is:

  1. rebuild options from scratch using new data
  2. remember the previous scroll position
  3. not crash when scrolling/zooming

In my real app, I achieve the first 2 points by taking the values from chart.getOption and manually merging them into the new object.

Environment

No response

Any additional comments?

In my real app, I've seen the issue even if the chart is rebuilt every 5 seconds instead of 100ms. As it seems to happen whenever chart.setOption, the interval was lowered to make it quicker to reproduce.

Although options does not change. In the real app, options could be built from the same data, but filtered to exclude certain data points.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions