artus9033/chartjs-plugin-dragdata

With tooltips disabled, TypeError: Cannot read property 'update' of undefined

artus9033 opened this issue · 2 comments

There is a bug if the chart is configured to have disabled tooltips (options: { plugins: { tooltip: { enabled: false } } }):

chartjs-plugin-dragdata.js:1531 Uncaught TypeError: Cannot read property 'update' of undefined
    at Object.beforeEvent (chartjs-plugin-dragdata.js:1531)
    at callback (helpers.segment.js:92)
    at PluginService._notify (chart.esm.js:4922)
    at PluginService.notify (chart.esm.js:4909)
    at Chart.notifyPlugins (chart.esm.js:6047)
    at Chart._eventHandler (chart.esm.js:6069)
    at Chart.update (chart.esm.js:5641)
    at updateData (chartjs-plugin-dragdata.js:1476)
    at HTMLCanvasElement.<anonymous> (chartjs-plugin-dragdata.js:1524)
    at Dispatch.call (chartjs-plugin-dragdata.js:63)```

It seems like the call there does not check whether `chart.tooltip` is nullish.

Good find @artus9033! Issues like this one constantly remind me of why I need to work on #40...
Also thanks for the PR, will merge ASAP

Published in 2.2.4