-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Expected behavior
Check if canvas is 'null' before calling addListener(canvas, type,proxy).
function createProxyAndListen(chart, type, listener) {
const canvas = chart.canvas;
const proxy = helpers_segment.throttled((event)=>{
if (chart.ctx !== null) {
listener(fromNativeEvent(event, chart));
}
}, chart);
addListener(canvas, type, proxy);
return proxy;
}
Current behavior
Cannot read properties of null (reading 'addEventListener')
TypeError: Cannot read properties of null (reading 'addEventListener')
at addListener (http://localhost:3000/static/js/bundle.js:323367:8)
at createProxyAndListen (http://localhost:3000/static/js/bundle.js:323496:3)
at DomPlatform.addEventListener (http://localhost:3000/static/js/bundle.js:323539:21)
at _add (http://localhost:3000/static/js/bundle.js:326413:16)
at http://localhost:3000/static/js/bundle.js:326421:96
at each (http://localhost:3000/static/js/bundle.js:332240:12)
at Chart.bindUserEvents (http://localhost:3000/static/js/bundle.js:326421:66)
at Chart.bindEvents (http://localhost:3000/static/js/bundle.js:326402:10)
at Chart._checkEventBindings (http://localhost:3000/static/js/bundle.js:326088:12)
at Chart.update (http://localhost:3000/static/js/bundle.js:326032:10)
Reproducible sample
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
No response
chart.js version
4.2.1
Browser name and version
No response
Link to your project
No response