{"push_id":1374878970,"size":1,"distinct_size":1,"ref":"refs/heads/fix-redirecting-in-validation-hooks","head":"e93f8efd3b485183fbe189cbb93dd9fca1fb369f","before":"fbe33a722762969382de6f248b38abb9aa76dd02","commits":[{"sha":"e93f8efd3b485183fbe189cbb93dd9fca1fb369f","author":{"name":"Alex Speller","email":"af52d3065b8b78750f844012b8e34dbc454a5a0a@alexspeller.com"},"message":"Fix validation stage redirection behaviour.\n\nThis has been broken forever AFAIK, and is surprising to a lot of people. In\nfact, even the ember guides recommend [using `this.transitionTo` for redirecting](https://guides.emberjs.com/v2.9.0/routing/redirection/)\n\nThis is in fact broken. If you use `transitionTo` as a redirect strategy,\nthen you get an extra history entry if you hit the route as the first route in\nyour app. This breaks the back button, as the back button takes you to the route\nwith the redirect, then immediately redirects back to the page you're on.\nMaybe you can go back if you hammer back button really quickly, but you have to\nhammer it loads super quick. Not a good UX.\n\n`replaceWith` works if you use it to redirect from a route that's your\ninitial transition. However if you use it to redirect and you hit that route\nfrom some way _after_ the initial app load, then at the point that the\nreplaceWith is called, you are still on the same URL. For example, if you are on\n`/` and you click a link to `/foo`, which in it's model hook redirects to `/bar`\nusing `replaceWith`, at the time replaceWith is called, your current url is `/`.\n\nThis means `/` entry gets removed from your history entirely. Clicking back\nwill take you back to whatever page you were on before `/`, which often isn't\nevent your app, maybe it's google or something. This breaks the back button\nagain.\n\nThis commit should do the correct thing in all cases, allowing replaceWith and\ntransitionTo outside of redirects as specified by the developer but only allowing\ntransitionTo or replaceWith in redirects in a way that doesn't break the back\nbutton.","distinct":true,"url":"https://api.github.com/repos/alexspeller/router.js/commits/e93f8efd3b485183fbe189cbb93dd9fca1fb369f"}]}
{"actor":{"display_login":"alexspeller"}}