webark/ember-component-css

[0.7.0] Cannot read property 'name' of null

Closed this issue · 10 comments

After updating from 0.6.9 to 0.7.0 and logging in in our application (which does a transition), we get the following error:

Uncaught (in promise) TypeError: Cannot read property 'name' of null
    at RouterService.<anonymous> (route-styles.js:17)
    at sendEvent (metal.js:345)
    at RouterService.trigger (evented.js:110)
    at Class.<anonymous> (router.js:70)
    at sendEvent (metal.js:345)
    at Class.trigger (evented.js:110)
    at PrivateRouter.routeWillChange (router.js:179)
    at Transition.abort (router_js.js:366)
    at Transition.retry (router_js.js:401)
    at login.js:34
    at tryCatcher (rsvp.js:335)
    at invokeCallback (rsvp.js:506)
    at publish (rsvp.js:492)
    at rsvp.js:16
    at invoke (backburner.js:335)
    at Queue.flush (backburner.js:226)
    at DeferredActionQueues.flush (backburner.js:423)
    at Backburner._end (backburner.js:957)
    at Backburner._boundAutorunEnd (backburner.js:626)

I’ll look into this today. What’s the kind of transition you are doing? And what version?

@webark - well, I'm simply doing this.transitionToRoute('dashboard');, I guess that's where it blows up.

@boris-petrov what ember version..?

@webark - 3.10.0.

@webark - if you can't reproduce it simply and have no idea why that might happen, perhaps I can try debugging it for you?

https://github.com/ebryn/ember-component-css/blob/ed67bc61792a233c13b31ff574117a0e90fc2039/addon/instance-initializers/route-styles.js#L11

i assume that (solely based off of your stack trace) that your “will transition” has no “transition.to” for some reason, and i had assumed that since this is a hook where you are in a transition, that a “to” would be there. It could be happening somewhere else though, but that’s my guess.

You could try putting a “transition.to &&” before that. I would be curious why there is no to i’m your transition.

I've encountered this same issue too after upgrading >= 0.7.0.

As suggested above, transition.to is null, as are other properties like from and targetName:

Screen Shot 2019-06-11 at 17 14 12

This only appears to occur during a transition after logging in, which @boris-petrov also mentioned in the original report, so perhaps that's a common denominator? FWIW our auth is handled by ember-simple-auth. Perhaps there's something in how that is triggering the transition? Just a guess though.

I'm running into the same issue when ember-simple-auth tries to transition upon successful login.

The transition that breaks things seems to be a transition that gets aborted when ember-simple-auth tries to retry the attemptedTransition, which does have a to. Where the aborted transition comes from, I can't seem to figure out.

Also on Ember 3.10

@bitwolfe @boris-petrov @andybluntish added a quick "catch all" fix in #322. Will loop back around to this and add some tests later. Just wanted to try to unblock you all.

I would like a better way to handle these intermediary transitions, but don't know of a way to now.

0.7.2 is released. Please try it out.