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

Cannot read property 'trigger' of null #679

Closed
altrim opened this issue Apr 26, 2017 · 15 comments
Closed

Cannot read property 'trigger' of null #679

altrim opened this issue Apr 26, 2017 · 15 comments

Comments

@altrim
Copy link

altrim commented Apr 26, 2017

Hello,

While trying to debug this issue altrim/ember-cli-tooltipster#40.

I noticed that when the tooltipster is destroyed (in ember we call destroy when the component is removed from the dom) the references to the emitters are also removed https://github.com/iamceege/tooltipster/blob/master/dist/js/tooltipster.bundle.js#L2576

But then right after that somehow _trigger is called here https://github.com/iamceege/tooltipster/blob/master/dist/js/tooltipster.bundle.js#L1529
and at this point
https://github.com/iamceege/tooltipster/blob/master/dist/js/tooltipster.bundle.js#L2347 this.__$emitterPrivate is null hence the error.

@louisameline
Copy link
Collaborator

Hello, I can't reproduce an error while destroying an open tooltip. Could you please set up a jsFiddle reproducing the error that does not involve your library? Thank you.

@altrim
Copy link
Author

altrim commented Apr 27, 2017

I managed to reproduce it in this codepen https://codepen.io/anon/pen/eWgoGp . Try to click the link as soon as you hover over it (fast), don't wait for the tooltip to show up.
tooltip

@louisameline
Copy link
Collaborator

Thanks for spotting that. There was a timeout that should have been cleared upon destruction, it's fixed now, thank you.

@altrim
Copy link
Author

altrim commented Apr 28, 2017

Hey @louisameline the issue still persists, it's harder to reproduce now in the same codepen but it happens with a similar flow, clicking link that has tooltip which transitions to another page and removes it from the dom.

@louisameline
Copy link
Collaborator

Ok, I just need to see the issue to fix it, can you please provide a link?

@louisameline louisameline reopened this Apr 28, 2017
@altrim
Copy link
Author

altrim commented Apr 28, 2017

It's a bit harder to reproduce it without the ember part now, although that doesn't add additional stuff it just wraps your library in a component and normally when transitioning to another page it's removed from the dom it calls tooltipster('destroy'). I will try to reproduce it without ember, but in meantime if you have time and want to try it with the ember you can check this repo https://github.com/GCorbel/bug-tooltipster (just update tooltipster to 4.2.4)

@louisameline
Copy link
Collaborator

I run into trouble when trying to install the repo (windows computer). It would be nice if you could host it somewhere for me.

@altrim
Copy link
Author

altrim commented Apr 28, 2017

Here is the deployed version https://altrim.github.io/bug-tooltipster/
tooltip_bug

louisameline added a commit that referenced this issue Apr 28, 2017
@louisameline
Copy link
Collaborator

The alert is tricky because it suspends the execution of the script.

What seems to be happening is that we schedule "close in 350ms", then the alert lasts for 1s (or more), then the destroy method is called synchronously, and it sees that 1s has passed and thinks that the close timeout has been executed, but it hasn't because of the alert. I'm not sure how you could have created this bug without using an alert box or a synchronous xhr call!

Anyway, please try with my latest modification. I haven't made a release this time, I just pushed the commit.

@GCorbel
Copy link

GCorbel commented Apr 28, 2017

Hi,

It seems to work. I have to find a way to manage dependencies with a commit ref to publish the updated bug repo but I tried locally and I don't have the bug. I will confirm a little bit later.

Many thanks for your work !

@louisameline
Copy link
Collaborator

Great, you're welcome, let me know and I'll release.

@altrim
Copy link
Author

altrim commented Apr 28, 2017

Hi,
I also tried it now and it seems to work, can't reproduce it now. I think you can make a release now.

@altrim
Copy link
Author

altrim commented Apr 28, 2017

Thanks a lot for the help 👍

@GCorbel
Copy link

GCorbel commented Apr 28, 2017

Nice. I think we can close this issue and this other one altrim/ember-cli-tooltipster#40 once new releases are done.

Thanks for your help. I know it was a lot of works. I love Open Source!

@louisameline
Copy link
Collaborator

Great, it's released as v4.2.5. Thank you both for the reports, solved two bugs with one stone :)

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

3 participants