diff --git a/package.json b/package.json index a56ef3c4..09d568f6 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "nanohtml": "^1.2.4", - "nanologger": "^1.3.1", + "nanologger": "^2.0.0", "nanoraf": "^3.0.1", "nanotiming": "^7.2.0", "on-idle": "^3.1.4", @@ -82,14 +82,14 @@ "v8-compile-cache": "^2.0.0", "wasm-brotli": "^1.0.2", "watchify": "^3.10.0", - "wayfarer": "^6.6.3" + "wayfarer": "^7.0.0" }, "devDependencies": { "a-module-with-babelrc": "^1.0.0", "assert-html": "^1.1.5", - "choo": "^6.8.0", - "choo-devtools": "^2.3.3", - "choo-service-worker": "^2.4.0", + "choo": "^7.0.0", + "choo-devtools": "^3.0.0", + "choo-service-worker": "^3.0.0", "read-file-tree": "^1.1.0", "standard": "^11.0", "tachyons": "^4.9.1", diff --git a/ssr/choo.js b/ssr/choo.js index 419cbe08..267d0048 100644 --- a/ssr/choo.js +++ b/ssr/choo.js @@ -55,10 +55,6 @@ module.exports.listRoutes = function (app) { // // NOTE: state is never passed in it seems. Funky fn signature, this should be // fixed. -// -// NOTE: Choo currently doesn't use the passed-in state as the base. It probably -// should, so we can treat the state as the only stateful bits, and the rest is -// just context. module.exports.render = function (app, route, cb) { var state = {} @@ -80,8 +76,10 @@ module.exports.render = function (app, route, cb) { var res = { state: state } res.body = app.toString(route, state) delete res.state._experimental_prefetch // State needs to be serializable. - if (app.state.title) res.title = app.state.title - if (app.state.language) res.language = app.state.language + var title = state.title || app.state.title // Support for choo@6 + var lang = state.language || app.state.language // Support for choo@6 + if (title) res.title = title + if (lang) res.language = lang if (app.selector) res.selector = app.selector cb(null, res) }