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

Raises an exception if the component is destroyed before it initializes. #37

Open
kitsunde opened this issue Dec 19, 2016 · 2 comments
Open

Comments

@kitsunde
Copy link

kitsunde commented Dec 19, 2016

Because of the async nature of the initialization it's possible for someone to have removed the component that's being initialized raising:

Couldn't find the iframe element to create a YouTube player

This is very evident on mobile browsers for us where we have the player in a modal that can be closed and removed. The cause is here: https://github.com/oskarrough/ember-youtube/blob/master/addon/components/ember-youtube.js#L133

This in turn ends up getting logged as an error since the exception is raised all the way to the global exception logger, but it isn't really since the user has intentionally removed the element. I think there should be a check to see if the component has been destroyed or not.

@oskarrough
Copy link
Owner

oskarrough commented Dec 19, 2016

Thank you very much for reporting. Unfortunately I'm having quite a few issues with the async initialization. Any ideas where to put that check?

I tried toggling an ember-youtube component in a template but couldn't get the error to throw. Are you using the lazyload option on the component in the modal?

See #33 as well.

@oskarrough
Copy link
Owner

I've been trying to make it fail in this branch https://github.com/oskarrough/ember-youtube/tree/test-destroyed-component

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