Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method .route mutating params object #42

Open
RusinovAnton opened this issue Nov 10, 2016 · 2 comments
Open

Method .route mutating params object #42

RusinovAnton opened this issue Nov 10, 2016 · 2 comments
Labels

Comments

@RusinovAnton
Copy link

RusinovAnton commented Nov 10, 2016

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

@oltreseba
Copy link

oltreseba commented Jan 24, 2017

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.

@aaronlord
Copy link
Owner

Yeah, this is a bug.

@aaronlord aaronlord added the bug label Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants