From 9af9b1ad376b4afe9122382ed33638a09dbcf24f Mon Sep 17 00:00:00 2001 From: Tim Wisniewski Date: Sun, 11 Dec 2016 15:45:46 -0500 Subject: [PATCH] fix prev.location.params bug. closes #354 (#355) --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 8764756..e146564 100644 --- a/index.js +++ b/index.js @@ -126,13 +126,13 @@ function choo (opts) { const send = createSend('view: ' + route, true) return function chooWrap (params) { return function (state) { - const nwPrev = prev - prev = state - // TODO(yw): find a way to wrap handlers so params shows up in state const nwState = xtend(state) nwState.location = xtend(nwState.location, { params: params }) + const nwPrev = prev + prev = nwState // save for next time + if (opts.freeze !== false) Object.freeze(nwState) return handler(nwState, nwPrev, send) }