{"action":"created","issue":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/1491","repository_url":"https://api.github.com/repos/lhorie/mithril.js","labels_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1491/labels{/name}","comments_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1491/comments","events_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1491/events","html_url":"https://github.com/lhorie/mithril.js/issues/1491","id":197130177,"number":1491,"title":"[rewrite] Default route breaks the back button","user":{"login":"bruce-one","id":1100280,"avatar_url":"https://avatars.githubusercontent.com/u/1100280?v=3","gravatar_id":"","url":"https://api.github.com/users/bruce-one","html_url":"https://github.com/bruce-one","followers_url":"https://api.github.com/users/bruce-one/followers","following_url":"https://api.github.com/users/bruce-one/following{/other_user}","gists_url":"https://api.github.com/users/bruce-one/gists{/gist_id}","starred_url":"https://api.github.com/users/bruce-one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruce-one/subscriptions","organizations_url":"https://api.github.com/users/bruce-one/orgs","repos_url":"https://api.github.com/users/bruce-one/repos","events_url":"https://api.github.com/users/bruce-one/events{/privacy}","received_events_url":"https://api.github.com/users/bruce-one/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-22T09:28:11Z","updated_at":"2016-12-22T10:05:16Z","closed_at":null,"body":"### Description:\r\n\r\nWhen testing in a real browser (Firefox 52 dev edition, Chrome 55 and Vivaldi 1.6 tested), a history step seems to be added by the default route.\r\n\r\n### Steps to Reproduce:\r\n\r\n1. Go to https://google.com/\r\n2. Enter http://bl.ocks.org/bruce-one/raw/b257fe2bb02d64380aacd7e45c9368b2 in address bar and hit enter (or http://bl.ocks.org/bruce-one/raw/b257fe2bb02d64380aacd7e45c9368b2/e34287b7fd5fcaac261eb7b9fe5d693517ccd01b for a non-prefix setting version)\r\n3. Address should update to http://bl.ocks.org/bruce-one/raw/b257fe2bb02d64380aacd7e45c9368b2/#/a \r\n4. Hit back (and ime, nothing will happen because the browser is redirected to /a again (accessing the /a address directly works as expected))\r\n\r\n```\r\n    m.route.prefix('#')\r\n    m.route(app, '/a', {\r\n      '/a': { view: () => m('div', 'asdf')}\r\n    })\r\n```\r\n\r\n### Expected:\r\n\r\nShould go back to Google.\r\n\r\n### Actual:\r\n\r\nBrowser is redirected to /a again instantly.\r\n\r\n\r\n(Just noticed, there's a test for this but it seems invalid because applying the following patch fails:\r\n\r\n```\r\ndiff --git a/api/tests/test-router.js b/api/tests/test-router.js\r\nindex 8ebc58d..581ab5f 100644\r\n--- a/api/tests/test-router.js\r\n+++ b/api/tests/test-router.js\r\n@@ -78,6 +78,8 @@ o.spec(\"route\", function() {\r\n                                        callAsync(function() {\r\n                                                o(root.firstChild.nodeName).equals(\"DIV\")\r\n\r\n+\t\t\t\t\t\to($window.location.pathname).equals(\"/a\")\r\n\r\n+\r\n                                                $window.history.back()\r\n\r\n                                                o($window.location.pathname).equals(\"/\")\r\n```\r\n)"},"comment":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/comments/268765027","html_url":"https://github.com/lhorie/mithril.js/issues/1491#issuecomment-268765027","issue_url":"https://api.github.com/repos/lhorie/mithril.js/issues/1491","id":268765027,"user":{"login":"bruce-one","id":1100280,"avatar_url":"https://avatars.githubusercontent.com/u/1100280?v=3","gravatar_id":"","url":"https://api.github.com/users/bruce-one","html_url":"https://github.com/bruce-one","followers_url":"https://api.github.com/users/bruce-one/followers","following_url":"https://api.github.com/users/bruce-one/following{/other_user}","gists_url":"https://api.github.com/users/bruce-one/gists{/gist_id}","starred_url":"https://api.github.com/users/bruce-one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruce-one/subscriptions","organizations_url":"https://api.github.com/users/bruce-one/orgs","repos_url":"https://api.github.com/users/bruce-one/repos","events_url":"https://api.github.com/users/bruce-one/events{/privacy}","received_events_url":"https://api.github.com/users/bruce-one/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T10:05:16Z","updated_at":"2016-12-22T10:05:16Z","body":"No, not only hash mode :-s\r\n\r\n```\r\n--- a/api/router.js                                                                                                                                                       \r\n+++ b/api/router.js                                                                                                                                                       \r\n@@ -15,7 +15,7 @@ module.exports = function($window, redrawService) {                                                                                                     \r\n                        if (render != null) redrawService.render(root, render(Vnode(component, attrs.key, attrs)))                                                        \r\n                }                                                                                                                                                         \r\n                var bail = function() {                                                                                                                                   \r\n-                       route.set(defaultRoute)                                                                                                                           \r\n+                       routeService.setPath(defaultRoute, null, { replace: true })                                                                                       \r\n                }                                                                                                                                                         \r\n                routeService.defineRoutes(routes, function(payload, params, path) {                                                                                       \r\n                        var update = lastUp\r\n```\r\n\r\nfixes non-hash -- but not hash mode.\r\n\r\nDoesn't fix the tests though :-s"}}
{"actor":{"display_login":"bruce-one"}}