iron-meteor/iron-url

Undefined being added to URL parameter value

Closed this issue · 3 comments

My route looks like this:

Router.map(function() {
  this.route('ship.parcel.addressChooser', {path: '/ship/choose-address/:_id',});
});

And I call Router.go() like this:

Router.go('ship.parcel.addressChooser', {_id: parcelId});

The parcelId is a string that equals PP-dev-KrdGbz

The resulting url that I get sent to ends up being this: http://localhost:3002/ship/choose-address/undefinedPP-dev-KrdGbz

You can see that there is an extra undefined in that URL. When going deep into my debugger, I found the following:

image

Basically, the parameter format is undefined, which then gets appended as a string to the final path. I'm not sure what the purpose of that match parameter is, but it seems like you could just do the same thing that you are doing with the slash match parameter here right below that line like this: format = format || '';

Created a pull request with the change. #16

I can reproduce this issue. Traced it to the line indicated at 338 of @wallslide's screenshot.

should be fixed in 1.0.9