From 6cf13af5ce7b12166381c92a7baf7e32a54e790a Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Wed, 26 Apr 2017 13:52:34 +0200 Subject: [PATCH] warn on unmount (#485) --- index.js | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2b08f2d..959ad70 100644 --- a/index.js +++ b/index.js @@ -57,6 +57,7 @@ function Choo (opts) { } var newTree = router(createLocation()) tree = nanomorph(tree, newTree) + assert.notEqual(tree, newTree, 'choo.start: a different node type was returned as the root node on a rerender. Make sure that the root node is always the same type to prevent the application from being unmounted.') if (hasPerformance && timingEnabled) { window.performance.mark('choo:renderEnd') window.performance.measure('choo:render', 'choo:renderStart', 'choo:renderEnd') diff --git a/package.json b/package.json index 7cad350..f69477f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "deps": "dependency-check --entry ./html.js . && dependency-check . --extra --no-dev --entry ./html.js", "inspect": "browserify --full-paths index -g unassertify -g uglifyify | discify --open", "prepublish": "npm run build", - "start": "bankai start example --optimize", + "start": "bankai start example", "test": "standard && npm run deps && node test.js" }, "repository": "yoshuawuyts/choo",