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

[Error] Get error when $destroy is started. #149

Closed
denislapi opened this issue Jul 20, 2017 · 2 comments
Closed

[Error] Get error when $destroy is started. #149

denislapi opened this issue Jul 20, 2017 · 2 comments

Comments

@denislapi
Copy link

Expected Behavior

I want to be able to change my route (from route with chart components -> to other component/route) without getting the following error:

Error:
build.js:22 Uncaught TypeError: Cannot read property 'destroy' of undefined

Line where I get this error:

methods: {     
render: function(e, t) {
    var n = (0,
    u.mergeOptions)(this.defaultOptions, t);
    this._chart = new s.default(this.$els.canvas.getContext("2d"),{
       type: "doughnut",
       data: e,
       options: n
     }),
      this._chart.generateLegend()
    }
},
beforeDestroy: function() {
   this._chart.destroy() // I get error on this line so I guess need to check if  '_chart' exist
}

Actual Behavior

I don't need this error so want to be able to change route without getting this error.

BTW I'm using NPM to access this package so would be good if I can update it once you find the way to fix this issue

I tried to add the following code in chart component which I use in my template but I'm not sure if that will resolve my problem.


beforeDestroy: function() {
   if(this._chart) {
      this._chart.destroy() 
   }

Environment

  • vue.js version: ^1.0.7
  • vue-chart.js version: ^1.1.5
  • npm version: -/-
@denislapi
Copy link
Author

@apertureless Hey mate! When this could be fixed? We are using this for our dashboard so would be great to fix this asap!

Peace!

@apertureless
Copy link
Owner

It is fixed in vue-chartjs@1.2.0 :)

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

No branches or pull requests

2 participants