-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@canufeel Thank you! |
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). |
Yes I'll do the cherry pick and release it next week! |
Ok, awesome! 🎉 |
@chancancode this is hitting our own app 😄 |
Trying to access
this.$()
inwillDestroyElement
now returnsundefined
aswillDestroyElement
hook is run after the component enters thedestroying
state since 3dcde0f was merged (2.9.0-beta.1). In versions before thatwillDestroyElement
was called before transitioning todestroying
state so the component was usinginDom
state object that would processthis.$()
properly.Technically the element is still accessible but we have to use
$(this.element)
instead ofthis.$()
which makes upgrading cumbersome as it is breaking apps that utilisewillDestroyElement
to deregister eventHandlers previously registered on component element.Fixes #14666