-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular (2), Chart.JS and Redux freeze exceptions #4157
Comments
I think we could support this. It just means that live data updates will not work. |
@simonbrunel thoughts? |
@philjones88 can you provide a live test case that reproduce this issue? |
A NG (2) + NG2-Charts + Chart.js example http://plnkr.co/edit/WFpWrrD7FPtl1dmUuuVS?p=preview I used the demo from: http://valor-software.com/ng2-charts/ and simply wrapped one of the datasets in See
And boom. Same trace. |
Checking that // ...
if (me._data !== data) {
if (me._data) {
// This case happens when the user replaced the data array instance.
unlistenArrayEvents(me._data, me);
}
if (data && !Object.isFrozen(data)) {
listenArrayEvents(data, me);
}
me._data = data;
}
// ... |
Good idea! I like that, keeps it nice and simple 😄 |
This is still an issue with Angular 5.0, Chart.js 2.7.1, Ngrx 4.1.1. The above fix suggested by @simonbrunel works. |
When trying to combine Angular (2) Redux and Chart.JS you end up with an exception as the arrays of data / labels are frozen.
i.e. https://github.com/buunguyen/redux-freeze
I traced it back to an error in zone.js
Cannot read property 'toString' of null
Stepping through the methods:
buildOrUpdateElements -> listenArrayEvents
which tries to do add listeners and it blows up
Expected Behavior
It should handle failing to add listeners to a frozen array
Current Behavior
Exception
Possible Solution
Detect frozen arrays
Steps to Reproduce (for bugs)
Context
I can't use Chart.JS in my Angular (2.4.10) application on pages with Redux data.
Environment
The text was updated successfully, but these errors were encountered: