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

Events cleanup #12

Closed
engwan opened this issue Jul 10, 2015 · 2 comments · Fixed by #13
Closed

Events cleanup #12

engwan opened this issue Jul 10, 2015 · 2 comments · Fixed by #13

Comments

@engwan
Copy link
Contributor

engwan commented Jul 10, 2015

When I navigate away from a component that's resize aware and then resize the window, I get an error:

Uncaught TypeError: Cannot read property '0' of undefined

on this line:

 return this.$()[0].getClientRects()[0];

I assume because the events are not cleaned up? Should the mixin also include a willDestroyElement hook that removes the event listeners?

Also, it's good to add a reminder to the docs to call this._super on didInsertElement if it's overriden when using the mixin. Took me a while to realize why it wasn't working.

@localpcguy
Copy link

FYI for anyone coming across this error in the future, ensure that if your component calls willDestroyElement it also calls this._super. Like the initial comment, took me a little while to realize that was why the events were not being de-registered and that then caused the initial error.

@sheriffderek
Copy link

I would probably have run into this later today! Glad I saw this. That sounds like a good thing to add to the readme. (I know - maybe you should know* this already) --- but it would be a nice reminder.

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

Successfully merging a pull request may close this issue.

3 participants