-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
fix: clear readyQueue with dispose #6967
Conversation
I updated this pull request slightly when adding a unit test I realized that this case will also throw an error when it happens about |
src/js/mixins/evented.js
Outdated
const validateTarget = (target) => { | ||
if (!target.nodeName && !isEvented(target)) { | ||
throw new Error('Invalid target; must be a DOM node or evented object.'); | ||
const validateTarget = (target, obj, fnName) => { |
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.
Made these errors more specific.
src/js/mixins/evented.js
Outdated
if (!target.nodeName && !isEvented(target)) { | ||
throw new Error('Invalid target; must be a DOM node or evented object.'); | ||
const validateTarget = (target, obj, fnName) => { | ||
if (!target || (!target.nodeName && !isEvented(target))) { |
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.
Check if target is null before trying to check a property on it.
src/js/mixins/evented.js
Outdated
@@ -398,6 +418,8 @@ const EventedMixin = { | |||
* Whether or not the default behavior was prevented. | |||
*/ | |||
trigger(event, hash) { | |||
validateTarget(this.eventBusEl_, this, 'trigger'); |
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.
validate on trigger, this is likely the cause of the issue we see in dom
If it can be split out into two PRs, that would be nice. The changes look good. |
Moved the evented changes to #6982 |
Description
Seems like we never clear the internal
readyQueue_
when callingdispose
which may cause the issues seen in #6701 (comment) and #5706