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

[BUGFIX release] this.$() undefined in willDestroyElement hook #14685

Merged
merged 2 commits into from
Dec 14, 2016

Conversation

canufeel
Copy link

@canufeel canufeel commented Dec 6, 2016

Trying to access this.$() in willDestroyElement now returns undefined as willDestroyElement hook is run after the component enters the destroying state since 3dcde0f was merged (2.9.0-beta.1). In versions before that willDestroyElement was called before transitioning to destroying state so the component was using inDom state object that would process this.$() properly.

Technically the element is still accessible but we have to use $(this.element) instead of this.$() which makes upgrading cumbersome as it is breaking apps that utilise willDestroyElement to deregister eventHandlers previously registered on component element.

Fixes #14666

@canufeel canufeel closed this Dec 6, 2016
@canufeel canufeel reopened this Dec 6, 2016
Copy link
Contributor

@krisselden krisselden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me otherwise

@@ -9,6 +10,12 @@ import _default from './default';
const destroying = Object.create(_default);

assign(destroying, {
$(view, sel) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets just move it out of states and just make this the method

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisselden Thanks for review! View mixin seems to be the most appropriate place for that method. PR updated.

@chancancode chancancode merged commit 4d93b1a into emberjs:master Dec 14, 2016
@chancancode
Copy link
Member

@canufeel Thank you!

@hemp
Copy link

hemp commented Dec 15, 2016

With the context of #14666, thoughts on if this be worthy of cherry-picking back to 2.10.x since it introduced unexpected behavior during an upgrade from 2.9 to 2.10?

Otherwise I think we might end up waiting to upgrade from 2.9 until 2.11 stable is cut (which is no problem).

@chancancode
Copy link
Member

Yes I'll do the cherry pick and release it next week!

@hemp
Copy link

hemp commented Dec 15, 2016

Ok, awesome! 🎉

@wagenet
Copy link
Member

wagenet commented Dec 19, 2016

@chancancode this is hitting our own app 😄

@chancancode
Copy link
Member

@hemp @canufeel @wagenet this is released in 2.10.2, thanks again for working on this!

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 this pull request may close these issues.

5 participants