-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cannot use id param for query strings #206
Comments
Can anyone reproduce this? I'll give it a try this Friday if not, just to see if it's still a bug and if it is we'll get a fix in. |
I can reproduce this and i think its this function normalizeParams in routes.js, correct me if i am wrong.
|
Any progress on this? |
A model usually has more than 2 properties. So we check that when passing down a single model to the `route()` param parameter. I would prefer removing this check altogether since it introduces more problems than it solves. However, this update allows for use cases like this: `route('report', { type: 'post', id: 123 })`. Fixes tighten#206
I confirm this behavior. Debug result of |
@KuNman did the route you were building this for have an optional id param by chance? i.e. The issue I think is the check in e.g.: if (
params.hasOwnProperty('id') && this.template.indexOf('{id}') == -1
) {
params = [params.id];
} needs to be: if (
params.hasOwnProperty('id') &&
(this.template.indexOf('{id}') == -1 && this.template.indexOf('{id?}') == -1)
) {
params = [params.id];
} Edit: Just realised that #263 actually solves the problem as above. This definitely seems to be the issue only thing now is to merge it in and mark this as resolved. |
I got a route with no param declared, and i'm using like this:
/something?0=1
something?type=a&id=1
Probably introduced by #143
The text was updated successfully, but these errors were encountered: