Skip to content

Commit

Permalink
fix(router): pass params on newstate
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshuawuyts committed Dec 3, 2016
1 parent c0c5dce commit 553decd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function choo (opts) {
// create a new router with a custom `createRoute()` function
// (str?, obj) -> null
function createRouter (routerOpts, routes, createSend) {
var prev = {}
var prev = null
if (!routes) {
routes = routerOpts
routerOpts = {}
Expand All @@ -129,9 +129,11 @@ function choo (opts) {
const nwPrev = prev
prev = state

console.log('params', params)

// TODO(yw): find a way to wrap handlers so params shows up in state
const nwState = xtend(state)
nwState.location = xtend(nwPrev.location, { params: params })
nwState.location = xtend(nwState.location, { params: params })

if (opts.freeze !== false) Object.freeze(nwState)
return handler(nwState, nwPrev, send)
Expand Down

0 comments on commit 553decd

Please sign in to comment.