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

Cannot read property 'eventName' of undefined #14888

Closed
noslouch opened this issue Jan 30, 2017 · 16 comments · Fixed by #14890
Closed

Cannot read property 'eventName' of undefined #14888

noslouch opened this issue Jan 30, 2017 · 16 comments · Fixed by #14890
Labels

Comments

@noslouch
Copy link

I've got a component which is conditionally rendered based on the value of a boolean. If that boolean value is changed by an action from within that component, the above error is thrown when the component is removed from the view.

Seems like it was introduced with canary and is happening from 2.13.0-alpha.1-canary+96c0bb79 onward.

Here's a simple twiddle demonstrating: https://ember-twiddle.com/b86adfba657f450a4d264e01a3fb0d37?openFiles=templates.application.hbs%2Ctemplates.components.my-component.hbs

Seems related to #1643. The stack trace points to the same block patched by pivotal-topher-bullock@74e0d58.

Stack trace:

Uncaught TypeError: Cannot read property 'eventName' of undefined
    at HTMLButtonElement.<anonymous> (ember.debug.js:43826)
    at HTMLDivElement.dispatch (VM229 jquery.js:4670)
    at HTMLDivElement.elemData.handle (VM229 jquery.js:4338)
    at Object.trigger (VM229 jquery.js:4579)
    at Object.simulate (VM229 jquery.js:4906)
    at HTMLDocument.handler (VM229 jquery.js:5169)
    at clear (ember.debug.js:916)
    at UpdatableBlockTracker.reset (ember.debug.js:916)
    at TryOpcode.handleException (ember.debug.js:1070)
    at UpdatingVMFrame.handleException (ember.debug.js:1071)

// disclosed
(anonymous) @ ember.debug.js:43826
dispatch @ VM229 jquery.js:4670
elemData.handle @ VM229 jquery.js:4338
trigger @ VM229 jquery.js:4579
simulate @ VM229 jquery.js:4906
handler @ VM229 jquery.js:5169
clear @ ember.debug.js:916
reset @ ember.debug.js:916
handleException @ ember.debug.js:1070
handleException @ ember.debug.js:1071
_throw @ ember.debug.js:1070
evaluate @ ember.debug.js:862
execute @ ember.debug.js:1070
rerender @ ember.debug.js:1057
_this.render @ ember.debug.js:13523
runInTransaction @ ember.debug.js:24861
_renderRoots @ ember.debug.js:13784
_renderRootsTransaction @ ember.debug.js:13822
_revalidate @ ember.debug.js:13861
invoke @ ember.debug.js:1902
flush @ ember.debug.js:1970
flush @ ember.debug.js:2094
end @ ember.debug.js:2164
run @ ember.debug.js:2287
run @ ember.debug.js:24085
handler @ ember.debug.js:13301
(anonymous) @ ember.debug.js:43827
dispatch @ VM229 jquery.js:4670
elemData.handle @ VM229 jquery.js:4338

noslouch pushed a commit to nypublicradio/nypr-account-settings that referenced this issue Jan 30, 2017
@rwjblue
Copy link
Member

rwjblue commented Jan 30, 2017

Thank you for reporting!!!

@GavinJoyce - This is related to the event dispatcher refactors, mind taking a look?

@noslouch
Copy link
Author

you're welcome! :D

small addition, the same error is thrown when that component is added back to the view. also demonstrated in that twiddle.

@GavinJoyce
Copy link
Member

Sure, I'll take a look

@GavinJoyce
Copy link
Member

It looks like this guard is needed:

screen shot 2017-01-30 at 21 30 11

I'm working on a test now

GavinJoyce added a commit to intercom/ember.js that referenced this issue Jan 30, 2017
@rwjblue
Copy link
Member

rwjblue commented Jan 30, 2017

Oh no! There was even a comment explaining why it was needed. If only we had a test too...

@GavinJoyce
Copy link
Member

I'm having trouble creating a failing test. I believe that this should fail, but it doesn't:

#14889

@GavinJoyce
Copy link
Member

I could manually unregister the action and ensure that an exception isn't thrown, but I'd much rather use the high level API to drive the test. Suggestions welcome

GavinJoyce added a commit to intercom/ember.js that referenced this issue Jan 30, 2017
@noslouch
Copy link
Author

Looks like Firefox doesn't throw, but Chrome does. Can you run your travis build in Chrome?

@GavinJoyce
Copy link
Member

Can you run your travis build in Chrome?

I haven't yet managed to create a failing test in Chrome

@noslouch
Copy link
Author

ah. hm. these are the userland tests that fail: https://circleci.com/gh/nypublicradio/nypr-account-settings/52

@GavinJoyce
Copy link
Member

@noslouch thanks, can you point me to the source of a failing test?

@noslouch
Copy link
Author

GavinJoyce added a commit to intercom/ember.js that referenced this issue Jan 30, 2017
@GavinJoyce
Copy link
Member

oh, I see. I need to trigger a focusout after the click has been handled

@GavinJoyce
Copy link
Member

The fix is here: #14890

It's late here are creating a failing test is proving tricky. I think we should merge the fix and leave this issue open until I follow up with a test later this week

rwjblue added a commit that referenced this issue Jan 30, 2017
@rwjblue rwjblue reopened this Jan 31, 2017
GavinJoyce added a commit to intercom/ember.js that referenced this issue Jan 31, 2017
GavinJoyce added a commit to intercom/ember.js that referenced this issue Jan 31, 2017
GavinJoyce added a commit to intercom/ember.js that referenced this issue Jan 31, 2017
@GavinJoyce
Copy link
Member

Here's a (non-ideal IMO) test which will prevent a regression: #14889

rwjblue pushed a commit that referenced this issue Feb 16, 2017
(cherry picked from commit 75fed9b)
devdesai pushed a commit to devdesai/ember.js that referenced this issue Mar 27, 2017
devdesai pushed a commit to devdesai/ember.js that referenced this issue Mar 28, 2017
mmun added a commit that referenced this issue Mar 28, 2017
@mixonic
Copy link
Member

mixonic commented Mar 30, 2017

Fixed in #15080

@mixonic mixonic closed this as completed Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants