11
votes

I've simply added a new route to my application and when I transition to it Ember throws the error "Cannot read property 'shouldSupercede' of undefined".

Here is my router:

App.Router.map ()->
    @resource 'pages', ->
        @resource 'page', {path: ':page_id'}, ->
            # lots of routes under here, all work

    @route 'design' # new route that error happens when transition to

I started looking through the router code but I'm really not sure what's going on and hoping that there is something obvious that I'm missing. If I add some logging inside ember the error is actually thrown when it's doing some lookup on the page route here, but again that route itself works fine.

Also it doesn't matter if I'm transitioning from the page route or not, if I just reload the page with it already at the design route I get the same error:

Transitioned into 'design' ember.js?body=1:14464
Uncaught TypeError: Cannot read property 'shouldSupercede' of undefined 
3
Does it have a template?Patsy Issa
@PatsyIssa yes it does, I think I'm actually getting close to the causeDEfusion
Could you add your link-to code as well, routes vs resources are a bit tricky but I would make the design route into a resourcePatsy Issa
if you can create a jsbin that reproduces, that would be helpfullAsgaroth

3 Answers

20
votes

One reason for this issue is a {{#link-to}} pointing at a route that has a dynamic segment without providing that segment.

The error message was definitely not very helpful in pointing in the right direction unfortunately.

0
votes

I was having this issue when I had a route with a dynamic segment and was not passing a value to that dynamic segment. Is there really no way to make an optional dynamic segment in Ember? may be useful to you.

0
votes

I started digging into the issue with the helpful message of DEfusion.

It turns out that I have some links like: {{#link-to product.show product}}.

So I've converted all such links to this: {{#link-to product.show product.id}}. And my issue was solved.

Also you may want to check all usages with replaceWith, replaceRoute and transitionTo