laroute icon indicating copy to clipboard operation
laroute copied to clipboard

Method .route mutating params object

Open RusinovAnton opened this issue 8 years ago • 2 comments

const params = { id: 1 }
Laroute.route(route, params)
console.log(params) // > {}

Hi, I've experienced a bug when by using route method and passing object with params to it, I get my object kinda destroyed. This issue is occurs in the replaceNamedParameters() I believe.

@aaronlord

RusinovAnton avatar Nov 10 '16 13:11 RusinovAnton

Yeah, apparently Laroute is deleting all the matching variables from the param array. This is for using some variables as params, if they match, and all the other variables as query string.

Therefore something like:

const params = { id: 1 };
Laroute.route(route1, params);
Laroute.route(route2, params);

Will not work.

I think that Laroute should make a copy of the passed parameters and use them.

oltreseba avatar Jan 24 '17 16:01 oltreseba

Yeah, this is a bug.

aaronlord avatar Feb 07 '17 15:02 aaronlord