leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.48k stars 370 forks source link

axis._found null is not iterable #923

Closed tbj128 closed 2 months ago

tbj128 commented 2 months ago

Hello!

I've noticed when rendering a large number of datapoints across multiple series (> 1000 points, > 5 series), sometimes (~25% of the time) I will run into the following error:

Uncaught TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
    at drawAxesGrid (uPlot.esm.js:4469:1)
    at uPlot.esm.js:4762:1
    at Array.forEach (<anonymous>)
    at _commit (uPlot.esm.js:4762:1)

This error is referencing this line: https://github.com/leeoniya/uPlot/blob/5756e3e9b91270b303157e14bd0174311047d983/src/uPlot.js#L1950

Since the value of this field starts is only set in this method: https://github.com/leeoniya/uPlot/blob/5756e3e9b91270b303157e14bd0174311047d983/src/uPlot.js#L1787

Could there be a race condition that leads into this error?

If not, do you have any recommendations on what might be causing this error? Thanks!

leeoniya commented 2 months ago

would you mind making a jsfiddle repro that i can debug? e.g. https://jsfiddle.net/vmy4hfq8/

tbj128 commented 2 months ago

Unfortunately I'm unable to replicate in the JSFiddle so it might be due to the uplot-react wrapper we're using. I've added a null-check patch into our code base for now. I will reopen this issue if I can replicate. Thanks for the quick response.