Skip to content

Commit

Permalink
Update for choo@7 (#527)
Browse files Browse the repository at this point in the history
* Update choo

* Remove choo peerDependency

* Add support for choo@6
  • Loading branch information
tornqvist committed Aug 12, 2019
1 parent ff9533d commit 240cc28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": "^12.0.1",
"tachyons": "^4.9.1",
Expand Down
10 changes: 4 additions & 6 deletions ssr/choo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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)
}
Expand Down

0 comments on commit 240cc28

Please sign in to comment.