{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/10831","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/10831/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/10831/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/10831/events","html_url":"https://github.com/emberjs/ember.js/issues/10831","id":66642649,"number":10831,"title":"Issue when replaceWith is used, doesn't keep browser state","user":{"login":"alexismangin","id":4203845,"avatar_url":"https://avatars.githubusercontent.com/u/4203845?v=3","gravatar_id":"","url":"https://api.github.com/users/alexismangin","html_url":"https://github.com/alexismangin","followers_url":"https://api.github.com/users/alexismangin/followers","following_url":"https://api.github.com/users/alexismangin/following{/other_user}","gists_url":"https://api.github.com/users/alexismangin/gists{/gist_id}","starred_url":"https://api.github.com/users/alexismangin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexismangin/subscriptions","organizations_url":"https://api.github.com/users/alexismangin/orgs","repos_url":"https://api.github.com/users/alexismangin/repos","events_url":"https://api.github.com/users/alexismangin/events{/privacy}","received_events_url":"https://api.github.com/users/alexismangin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-06T16:21:52Z","updated_at":"2015-04-15T16:33:35Z","closed_at":null,"body":"Hello,\r\nI just found out a bug when we use the method replaceWith.\r\nThe best thing to explain is an example.\r\n\r\nLet's say I'm in a page called `login`, and this page has a link to `register`.\r\n\r\n`login.hbs`\r\n```html\r\n{{#link-to 'register'}}Register{{/link-to}}\r\n```\r\n\r\nWhen I click the link, I am transitioned to the route `register`. My register happen to be in multiple steps, and the `login` page doesn't know anything about that, I decided to have the `register/index.js` route to redirect the user to the first step of the flow using `replaceWith`.\r\n\r\n`routes/register/index.js`\r\n```javascript\r\n...\r\nbeforeModel: function () {\r\n   this.replaceWith('register.step1');\r\n}\r\n...\r\n```\r\n\r\nDoing that, the user access the route `register.step1` without any problem.\r\n\r\nBut when the user press the browser back button, instead of going back to the `login` page, which was the page he's coming from, the user goes back to the page he was before he came to the `login`. I checked the browser state and it seems like the `login` page has been replaced by the `register.step1` page. The `login` doesn't appear anymore in the history.\r\n\r\nI believe the browser should keep the state of the page the user is coming from, even though there is a `replaceWith` call in between the transition.\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/93478371","html_url":"https://github.com/emberjs/ember.js/issues/10831#issuecomment-93478371","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/10831","id":93478371,"user":{"login":"jeradg","id":1948799,"avatar_url":"https://avatars.githubusercontent.com/u/1948799?v=3","gravatar_id":"","url":"https://api.github.com/users/jeradg","html_url":"https://github.com/jeradg","followers_url":"https://api.github.com/users/jeradg/followers","following_url":"https://api.github.com/users/jeradg/following{/other_user}","gists_url":"https://api.github.com/users/jeradg/gists{/gist_id}","starred_url":"https://api.github.com/users/jeradg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeradg/subscriptions","organizations_url":"https://api.github.com/users/jeradg/orgs","repos_url":"https://api.github.com/users/jeradg/repos","events_url":"https://api.github.com/users/jeradg/events{/privacy}","received_events_url":"https://api.github.com/users/jeradg/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T16:33:35Z","updated_at":"2015-04-15T16:33:35Z","body":"I just encountered this problem.\r\n\r\nIn my case, I was able to work around this by using `redirect` with `this.transitionTo()` (instead of `beforeModel` with `this.replaceWith()`). So with @alexismangin's routes:\r\n\r\n```js\r\n//...\r\nredirect: function () {\r\n   this.transitionTo('register.step1');\r\n}\r\n//...\r\n```\r\n\r\nWhen I used this version, the register.index route does not appear in the history, and pressing the back button renders the login view.\r\n\r\nThis might work for you as well, @alexismangin. "}}