chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
63.92k stars 11.89k forks source link

platform.isAttached should return false if canvas is false-y #11707

Closed DAcodedBEAT closed 3 months ago

DAcodedBEAT commented 3 months ago

Expected behavior

isAttached() from platform.dom.js should only call _getParentNode() on valid a truth-y canvas value.

Current behavior

TypeError: Cannot read properties of null (reading 'parentNode')
  at _getParentNode(../../node_modules/chart.js/dist/chunks/helpers.segment.js:1820:24)
  at DomPlatform.isAttached(../../node_modules/chart.js/dist/chart.js:3434:23)
  at _a.bindResponsiveEvents(../../node_modules/chart.js/dist/chart.js:6266:18)
  at _a.bindEvents(../../node_modules/chart.js/dist/chart.js:6211:12)
  at _a._checkEventBindings(../../node_modules/chart.js/dist/chart.js:5907:12)
  at _a.update(../../node_modules/chart.js/dist/chart.js:5856:10)
  at this._doResize(../../node_modules/chart.js/dist/chart.js:5624:46)
  at sentryWrapped(../../node_modules/@sentry/browser/esm/helpers.js:37:17)

From sentry:

image

Reproducible sample

.

Optional extra steps/info to reproduce

No response

Context

chart.js version

4.4.2

Browser name and version

Experienced on Chrome 122.0.0 according to my project's Sentry, but probably impacts others since this is missing a null check.

Link to your project

No response

DAcodedBEAT commented 3 months ago

Hello @etimberg / @LeeLenaleee 👋 Thanks again for the prompt review and merge. Do you have an ETA for the release of 4.5.0 ?

DAcodedBEAT commented 3 months ago

@chartjs When should I expect this to land? Should I run a fork in production in the interim?