kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 193 forks source link

Route parameter set to 0 (zero) is ignored #721

Open williamtetlow opened 7 years ago

williamtetlow commented 7 years ago

Steps to reproduce.

  1. Define route with parameter
FlowRouter.route('/example-route/:routeParam', {
  name: 'exampleRoute',
  action() {
    // Some action...
  },
});
  1. Attempt to go to route with routeParameter set to 0

FlowRouter.go('exampleRoute', { routeParam: 0 });

The value 0 for routeParam is ignored.

Guessing a generic is null/undefined check against the param will be causing this (i.e. if (routeParam) { do something })

Workaround is set to parameter as { routeParam: '0' }. However, this is counter intuitive when all other integers work as route parameters.

I can submit PR with fix if this is a feature you wish to include.

Wicloz commented 5 years ago

Just letting you know a fix for this would be appreciated as it it still an existing issue.