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

Using Modal Dialogs - undefined error in canary #10416

Closed
iamjstates opened this issue Feb 10, 2015 · 11 comments · Fixed by #10431
Closed

Using Modal Dialogs - undefined error in canary #10416

iamjstates opened this issue Feb 10, 2015 · 11 comments · Fixed by #10431

Comments

@iamjstates
Copy link

In canary the below code does not work and yields the following error:

Uncaught TypeError: Cannot read property 'routeName' of undefined

It points to *return this.render(modalName, *

App.ApplicationRoute = Ember.Route.extend({
  actions: {
    openModal: function(modalName) {
      return this.render(modalName, {
        into: 'application',
        outlet: 'modal'
      });
    }
  }
});
@ilkkao
Copy link
Contributor

ilkkao commented Feb 11, 2015

I noticed the same problem in my Selenium tests this morning. I didn't have time to debug so I went back to beta1 which fixed the problem.

@iamjstates
Copy link
Author

Thanks @ilkkao - I guess the team is aware of the problem?

@stefanpenner
Copy link
Member

@ef4 this may be related to the recent outlet fixes/refactoring

@ilkkao
Copy link
Contributor

ilkkao commented Feb 11, 2015

I just bisected the problem to #10372

In my case I use modals exactly as instructed here: http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs/

Maybe the example from there can be upgraded to use canary version to demonstrate the problem?

@ilkkao
Copy link
Contributor

ilkkao commented Feb 11, 2015

Wasn't too hard. Demo here: http://emberjs.jsbin.com/dupufilora/1/edit?html,js,output

Click 'change name' to see the error.

@ilkkao
Copy link
Contributor

ilkkao commented Feb 11, 2015

This is a duplicate of #10427

@rwjblue
Copy link
Member

rwjblue commented Feb 11, 2015

The error is being thrown from: ember-routing/lib/system/route.js. Basically, when rendering into an outlet in the application route, there are is no parent route and we are calling routeName on undefined.

@ef4 - Should we just guard against this (parentRoute(route) being undefined), or is there a better solution?

@ef4
Copy link
Contributor

ef4 commented Feb 11, 2015

Just adding a guard should be sufficient. I can work on it tonight if nobody gets to it first.

We should also make sure we add a regression test for this case.

@iamjstates
Copy link
Author

The fix works for opening modals, but this:

closeModal: function() {
    return this.disconnectOutlet({
      outlet: 'modal',
      parentView: 'application'
    });
  }

now yields: Uncaught TypeError: Cannot read property 'routeName' of undefined

ef4 added a commit to ef4/ember.js that referenced this issue Feb 12, 2015
This resolves the secondary issue reported in [a
comment](emberjs#10416 (comment))
on issue emberjs#10416.
@ef4
Copy link
Contributor

ef4 commented Feb 12, 2015

@iamjstates I just submitted another PR that takes care of disconnection too.

Thanks for being a beta tester. I've added all these scenarios to the integration tests so we never break these behaviors on people again.

@iamjstates
Copy link
Author

@ef4 - No worries, glad to help out in anyway.

ef4 added a commit that referenced this issue Feb 13, 2015
This resolves the secondary issue reported in [a
comment](#10416 (comment))
on issue #10416.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants