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

Uncaught (in promise) TypeError: Cannot read property '__eventTarget' of null #23

Open
timchu90 opened this issue Mar 15, 2017 · 2 comments

Comments

@timchu90
Copy link

Hello,

We are Vue newbies using Vue 2.1.0 and vue-charts 0.2.1.

In one of our components we have a table element, whose rows we want to be click-able:

<vue-chart
chart-type="Table"
:chart-events="chartEvents"

There's a particular path through our application that results in an error being thrown:

Uncaught (in promise) TypeError: Cannot read property '__eventTarget' of null

It seems like it happens when this vue chart is called second, after another chart is called first.
If this chart is called first before any others have been called, it works fine.
If the chart is called third or any subsequent calls, it works fine as well.

In our particular scenario, the first chart being called when the error occurs is a LineChart.

We're having a hard time debugging it because vue-charts is a bit of a black box to us and because we don't know what information to log to the console that could illuminate what's happening. If we delete the line:

:chart-events="chartEvents"

the issue goes away. So it's likely an issues with the eventBinding on the chart. Is it possible your previous bug-fix for this issue didn't fix it completely?

Thanks!

@rzb
Copy link

rzb commented Mar 31, 2017

I'm having the same problem and I have only 1 chart being rendered.

Can you show what you have inside chartEvents? Also, are you using material chart version?

@timchu90
Copy link
Author

Our chart event looked like this and only had a problem displaying when self.branch == "gene".

              chartEvents: {
                    'select': function() {
                        var selection = self.$refs.thisTable.chart.getSelection();
                        if (self.branch == "gene") {
                            for (var c in self.cancerDict){
                                if (self.cancerDict[c].name == self.rows[selection[0].row][0]){
                                    self.$store.commit(
                                        'setSelectedCancer',
                                        {id: self.cancerDict[c].id.toString(), name: self.cancerDict[c].name}
                                    );
                                    break;
                                }
                            }
                        }
                        else {
                            self.$store.commit('setSelectedGene', {
                                name: self.rows[selection[0].row][1],
                            });
                        }
                    }  
                },

In the end our (admittedly stupid) fix was to make a hidden empty table somewhere at the start of the page loading and it worked great after that.

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

No branches or pull requests

2 participants