lightweight-charts
lightweight-charts copied to clipboard
Calling `chart.subscribeCrosshairMove()` throws "Value is undefined" when hovering mouse over the chart
Lightweight Charts™ Version: 4.1.2
Steps/code to reproduce:
- Provide valid data
- Add a call to
chart.subscribeCrosshairMove()
- Hover the mouse over the timeline
- Alternates between throwing errors and triggering the callback just fine.
See the stackblitz example and screen recording below. Actual behavior:
When calling chart.subscribeCrosshairMove()
, an error "Value is undefined" is thrown when hovering mouse over the chart.
Expected behavior:
An error should not be thrown.. ? The callback is still firing fine most of the time. However the error also keeps randomly throwing.
Screenshots:
https://github.com/tradingview/lightweight-charts/assets/12685308/77dfb684-a049-4b27-8ee5-28ff7e6e7830
CodeSandbox/JSFiddle/etc link:
Here's the minimal viable reproducable example: https://stackblitz.com/edit/nuxt-starter-ruhnxp?file=app.vue.
My temporary solution is to suppress this with:
window.onerror = function (message: string | Event): boolean {
if (typeof message === 'string' && message.includes('Value is undefined')) {
// Prevent the error from being logged in the console
return true;
}
return false;
};
https://github.com/tradingview/lightweight-charts/assets/12685308/95324bb9-e134-4ba8-aa7d-5a16bab70f77
hello, I also encountered the same problem,any one can help to figure out the issue?
The issue still exists in 4.1.3. Please fix this as it blocks also the correct execution of single and double click events :/