From 602d048611c5f2a4a78538649dea45cfa692c549 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Fri, 15 Jul 2016 22:24:04 -0400 Subject: [PATCH] build --- api/router.js | 2 +- mithril.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/router.js b/api/router.js index de047896..ea848a36 100644 --- a/api/router.js +++ b/api/router.js @@ -22,7 +22,7 @@ module.exports = function($window, renderer, pubsub) { else { renderer.render(root, Node(payload, null, args, undefined, undefined, undefined)) } - }, function(path, params) { + }, function() { router.setPath(defaultRoute, null, {replace: true}) }) autoredraw(root, renderer, pubsub, replay) diff --git a/mithril.js b/mithril.js index d5a1cdff..626522ca 100644 --- a/mithril.js +++ b/mithril.js @@ -585,11 +585,14 @@ var renderService = function($window) { function onremove(vnode) { if (vnode.attrs && vnode.attrs.onremove) vnode.attrs.onremove.call(vnode.state, vnode) if (typeof vnode.tag !== "string" && vnode.tag.onremove) vnode.tag.onremove.call(vnode.state, vnode) - var children = vnode.children - if (children instanceof Array) { - for (var i = 0; i < children.length; i++) { - var child = children[i] - if (child != null) onremove(child) + if (vnode.instance != null) onremove(vnode.instance) + else { + var children = vnode.children + if (children instanceof Array) { + for (var i = 0; i < children.length; i++) { + var child = children[i] + if (child != null) onremove(child) + } } } } @@ -1071,7 +1074,7 @@ m.route = function($window, renderer, pubsub) { renderer.render(root, Node(payload, null, args, undefined, undefined, undefined)) } }, function(path, params) { - router.setPath(defaultRoute, params, {replace: true}) + router.setPath(defaultRoute, null, {replace: true}) }) autoredraw(root, renderer, pubsub, replay) }