{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/12700","repository_url":"https://api.github.com/repos/emberjs/ember.js","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/12700/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/12700/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/12700/events","html_url":"https://github.com/emberjs/ember.js/issues/12700","id":121520434,"node_id":"MDU6SXNzdWUxMjE1MjA0MzQ=","number":12700,"title":"Routes with empty paths steal indexes","user":{"login":"mmun","id":1151810,"node_id":"MDQ6VXNlcjExNTE4MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1151810?v=4","gravatar_id":"","url":"https://api.github.com/users/mmun","html_url":"https://github.com/mmun","followers_url":"https://api.github.com/users/mmun/followers","following_url":"https://api.github.com/users/mmun/following{/other_user}","gists_url":"https://api.github.com/users/mmun/gists{/gist_id}","starred_url":"https://api.github.com/users/mmun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmun/subscriptions","organizations_url":"https://api.github.com/users/mmun/orgs","repos_url":"https://api.github.com/users/mmun/repos","events_url":"https://api.github.com/users/mmun/events{/privacy}","received_events_url":"https://api.github.com/users/mmun/received_events","type":"User","site_admin":false},"labels":[{"id":187302,"node_id":"MDU6TGFiZWwxODczMDI=","url":"https://api.github.com/repos/emberjs/ember.js/labels/Bug","name":"Bug","color":"e10c02","default":false},{"id":360697975,"node_id":"MDU6TGFiZWwzNjA2OTc5NzU=","url":"https://api.github.com/repos/emberjs/ember.js/labels/Has%20Reproduction","name":"Has Reproduction","color":"b60205","default":false},{"id":556878754,"node_id":"MDU6TGFiZWw1NTY4Nzg3NTQ=","url":"https://api.github.com/repos/emberjs/ember.js/labels/Inactive","name":"Inactive","color":"d4c5f9","default":false},{"id":329522036,"node_id":"MDU6TGFiZWwzMjk1MjIwMzY=","url":"https://api.github.com/repos/emberjs/ember.js/labels/Routing","name":"Routing","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2015-12-10T16:07:08Z","updated_at":"2018-09-28T19:10:47Z","closed_at":null,"author_association":"MEMBER","body":"# Problem\r\n\r\nIf a non-leaf route (i.e. it has child routes) has an empty path (`{ path: '/' }`) it will steal the index from its parent.\r\n# Examples\r\n\r\nAn example at the top-level:\r\n\r\n``` js\r\nRouter.map(function() {\r\n  this.route('login');\r\n  this.route('admin', { path: '/' }, function() {\r\n    this.route('dashboard');\r\n  });\r\n});\r\n```\r\n\r\nTwiddle: https://ember-twiddle.com/7bb9deb4fc9e7039d3e5\r\n\r\nIn this case `index` will resolve to the full path `application.admin.index` rather than `application.index`.\r\n\r\nAnother example with nesting:\r\n\r\n``` js\r\nRouter.map(function() {\r\n  this.route('login');\r\n  this.route('project', function() {\r\n    this.route('admin', { path: '/' }, function() {\r\n      this.route('dashboard');\r\n    });\r\n  });\r\n});\r\n```\r\n\r\nTwiddle: https://ember-twiddle.com/d5f1693b8c2a66579446\r\n\r\nIn this case `index` resolves correctly to `application.index`, but transitioning to `project` will resolve to `application.project.admin.index` rather than `application.project.index`.\r\n# Why is this a bug?\r\n\r\nYou can convince yourself this is a bug in multiple ways. First, consider what happens when two sibling routes have empty paths:\r\n\r\n``` js\r\nRouter.map(function() {\r\n  this.route('foo', { path: '/' }, function() {});\r\n  this.route('bar', { path: '/' }, function() {});\r\n});\r\n```\r\n\r\nShould `index` map to `application.foo.index` or `application.bar.index`? Trick question! It should map to `application.index`. Currently the last route wins (`application.bar.index` here).\r\n\r\nSecondly, it's easy to add a redirect from `index` to `admin.index` if you want to preserve the current behavior, but implementing a \"redirect\" the other way is much more painful.\r\n\r\nLastly, this has implications on the isolation of mounted engines, but I won't bother fleshing this point out as engines don't exist yet ;)\r\n\r\n  "},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/425537386","html_url":"https://github.com/emberjs/ember.js/issues/12700#issuecomment-425537386","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/12700","id":425537386,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTUzNzM4Ng==","user":{"login":"mmun","id":1151810,"node_id":"MDQ6VXNlcjExNTE4MTA=","avatar_url":"https://avatars2.githubusercontent.com/u/1151810?v=4","gravatar_id":"","url":"https://api.github.com/users/mmun","html_url":"https://github.com/mmun","followers_url":"https://api.github.com/users/mmun/followers","following_url":"https://api.github.com/users/mmun/following{/other_user}","gists_url":"https://api.github.com/users/mmun/gists{/gist_id}","starred_url":"https://api.github.com/users/mmun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmun/subscriptions","organizations_url":"https://api.github.com/users/mmun/orgs","repos_url":"https://api.github.com/users/mmun/repos","events_url":"https://api.github.com/users/mmun/events{/privacy}","received_events_url":"https://api.github.com/users/mmun/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T19:10:47Z","updated_at":"2018-09-28T19:10:47Z","author_association":"MEMBER","body":"It's still an issue. The original repro should still be (in)valid."}}
{"actor":{"display_login":"mmun"}}