Cannot assign to read only property 'data' of object

See original GitHub issue

When using heatmap.js on certain browsers, this error Cannot assign to read only property 'data' of object shows up. screen shot 2016-09-01 at 11 18 47 am

I’m able to reproduce on chromium that is packaged with electron version 1.3.3.

This seems to happen because the data property of ImageData object is being replaced directly in this part of the code. https://github.com/pa7/heatmap.js/blob/master/src/renderer/canvas2d.js#L280

data property seems to be read only on certain browser versions. To fix it, we need to delete this line because imgData and img.data points to the same reference. Any modifications you do to imgData is already reflected to img.data. I’ll put up a PR soon.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:8
  • Comments:13

github_iconTop GitHub Comments

11reactions
njifarescommented, Aug 8, 2019

I’m facing the same issue using heatmapjs in my Angular application.

1reaction
iaaseihycommented, May 12, 2022

so how can this problem be solved in version 2.0.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot assign to read only property
When you use Object.defineProperties , by default writable is set to false , so _year and edition are actually read only properties.
Read more >
Cannot assign to read only property of Object in JavaScript
The error "Cannot assign to read only property of object" occurs when we try to change a property of an object that has...
Read more >
Cannot assign to read only property '<field_name>' of ...
This type of error(Cannot assign to read-only property) generally occurs on update of public property @api decorator variable value.
Read more >
TypeError: "x" is read-only - JavaScript - MDN Web Docs
The JavaScript strict mode-only exception "is read-only" occurs when a global variable or object property that was assigned to is a read-only property....
Read more >
Cannot assign to read only property 'X' of object '#<Object>'
This is most likely the issue, wired properties are immutable I believe. Best way to handle this is by using the spread operator...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found