From b6daeaab5aae50f45610e89ed9cec9e860b3c44f Mon Sep 17 00:00:00 2001 From: Bryce Gibson Date: Thu, 22 Dec 2016 21:12:50 +1100 Subject: [PATCH 1/3] Fix back button for default route. --- api/router.js | 2 +- mithril.js | 2 +- mithril.min.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/router.js b/api/router.js index ccfccb94..6f805de2 100644 --- a/api/router.js +++ b/api/router.js @@ -15,7 +15,7 @@ module.exports = function($window, redrawService) { if (render != null) redrawService.render(root, render(Vnode(component, attrs.key, attrs))) } var bail = function() { - routeService.setPath(defaultRoute) + routeService.setPath(defaultRoute, null, { replace: true }) } routeService.defineRoutes(routes, function(payload, params, path) { var update = lastUpdate = function(routeResolver, comp) { diff --git a/mithril.js b/mithril.js index a27e1734..104a4dac 100644 --- a/mithril.js +++ b/mithril.js @@ -1098,7 +1098,7 @@ var _20 = function($window, redrawService0) { if (render1 != null) redrawService0.render(root, render1(Vnode(component, attrs3.key, attrs3))) } var bail = function() { - routeService.setPath(defaultRoute) + routeService.setPath(defaultRoute, null, { replace: true }) } routeService.defineRoutes(routes, function(payload, params, path) { var update = lastUpdate = function(routeResolver, comp) { diff --git a/mithril.min.js b/mithril.min.js index f31212e4..dc602474 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -36,6 +36,6 @@ decodeURIComponent(g[1]):"";"true"===g?g=!0:"false"===g&&(g=!1);var l=m.split(/\ l&&(l=m(function(){l=null;a()}))}}function d(a,c,d){var b=a.indexOf("?"),g=a.indexOf("#"),k=-1 Date: Thu, 22 Dec 2016 21:14:52 +1100 Subject: [PATCH 2/3] Test precondition. --- api/tests/test-router.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/tests/test-router.js b/api/tests/test-router.js index 7e2454cb..c8bbfac1 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -78,6 +78,8 @@ o.spec("route", function() { callAsync(function() { o(root.firstChild.nodeName).equals("DIV") + o($window.location.pathname).equals("/a") + $window.history.back() o($window.location.pathname).equals("/") From f4084671bccdc6efe3638512166515307e0b5f36 Mon Sep 17 00:00:00 2001 From: Bryce Gibson Date: Thu, 22 Dec 2016 21:15:15 +1100 Subject: [PATCH 3/3] Typo. --- api/tests/test-router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/tests/test-router.js b/api/tests/test-router.js index c8bbfac1..47bc1ac5 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -51,7 +51,7 @@ o.spec("route", function() { o(root.firstChild.nodeName).equals("DIV") }) - o("routed mount points can redraw synchronoulsy (#1275)", function() { + o("routed mount points can redraw synchronously (#1275)", function() { var view = o.spy() $window.location.href = prefix + "/"