Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Fix issue when componentWillUnmount() #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mloisotto
Copy link

When componentWillUnmount, it tries to get chart object from this.state and execute destroy() function. This is not validating when chart is undefined or null.
This PR, only verifies that condition.

When componentWillUnmount, it tries to get chart object from this.state and execute destroy() function. This is not validating when chart is undefined or null.
This PR, only verifies that condition.
@@ -35,7 +35,8 @@ module.exports = {

classData.componentWillUnmount = function() {
var chart = this.state.chart;
chart.destroy();
if(chart)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the nitpick, but could you wrap this if statement with braces?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mloisotto Do you have an estimation on when you can get to this? I am currently being blocked by it. If you can't let me know and I can take over.

@benmccann
Copy link
Collaborator

@mloisotto this PR can be closed. The code is already in master: https://github.com/reactjs/react-chartjs/blob/master/lib/core.js#L33

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

Successfully merging this pull request may close these issues.

4 participants