Skip to content
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

Fixed undefined this on SeriesChart redraw #1800

Closed
wants to merge 1 commit into from

Conversation

blaze33
Copy link
Contributor

@blaze33 blaze33 commented Dec 13, 2020

I had the following bug when redrawing a SeriesChart:

dc.js:12456 Uncaught TypeError: Cannot read property '_charts' of undefined
    at _clearChart (dc.js:12456)
    at Array.map (<anonymous>)
    at SeriesChart._resetChildren (dc.js:12463)
    at SeriesChart.chart (dc.js:12482)
    at showUpdatedChart (panel.js:35)

The issue is that passing this._clearChart to map like that makes it unbound, thus the need to bind it again to this to clear the issue.
I spent a good time looking for this issue online and have found nothing, so if I'm misguided in any way, let me know, thanks!
Nonetheless, this fix solves correctly my use case.

I had the following bug when redrawing a SeriesChart:
```
dc.js:12456 Uncaught TypeError: Cannot read property '_charts' of undefined
    at _clearChart (dc.js:12456)
    at Array.map (<anonymous>)
    at SeriesChart._resetChildren (dc.js:12463)
    at SeriesChart.chart (dc.js:12482)
    at showUpdatedChart (panel.js:35)
```
The issue is that passing `this._clearChart` to `map` like that makes it unbound, thus the need to bind it again to `this` to clear the issue.
I spent a good time looking for this issue online and have found nothing, so if I'm misguided in any way, let me know, thanks!
Nonetheless, this fix solves correctly my use case.
@gordonwoodhull
Copy link
Contributor

Thanks @blaze33!

Looks like we missed this in f172fb7 when we converted to ES2015/ES6.

@blaze33
Copy link
Contributor Author

blaze33 commented Dec 13, 2020

Thanks for the quick answer! Glad to know I could help a bit :)

@gordonwoodhull
Copy link
Contributor

Released in 4.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants