From 55c1d3626f68c07fa1e4899ce81eaa713b79e0fe Mon Sep 17 00:00:00 2001 From: thdk Date: Sat, 2 Mar 2019 09:38:40 +0100 Subject: [PATCH] Do not ignore '0' from route params to build path Fixes kitze/mobx-router#72, Fixes kitze/mobx-router#46 --- src/route.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/route.js b/src/route.js index 6432dc0..f274f14 100644 --- a/src/route.js +++ b/src/route.js @@ -65,9 +65,10 @@ export class Route { // eslint-disable-next-line ([fullMatch, paramKey, paramKeyWithoutColon]) => { const value = jsParams[paramKeyWithoutColon]; - newPath = value - ? newPath.replace(paramKey, value) - : newPath.replace(`/${paramKey}`, ''); + newPath = + value !== undefined + ? newPath.replace(paramKey, value) + : newPath.replace(`/${paramKey}`, ''); } );