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
bug(router): Allowing multiple query params of the same name to be se… #11373
bug(router): Allowing multiple query params of the same name to be se… #11373
Conversation
c60ac1a
to
d44f4dc
Compare
…rialized into an array The current router will remove all but the last one if the url contains multiple query params of the same name. `router/foo?a=1&a=2&a=5` will be rewritten as `router/foo?a=5`
cd84066
to
ab3b216
Compare
I would really appreciate it if this fix would find its way into a version anytime soon :( |
@severinkehding we've had to bodge it on our site.
We've ran the new version and tell System JS to use that instead. Not idea but it works for now. |
Do I understand it correctly that |
@vsavkin Nope - if |
This was previously just strings, but after angular#11373 can also contain arrays of strings. Sadly the type declaration cannot be changed for backwards compatibility.
Am I crazy or does this functionality not work in reverse? If I create a let queryParams = {
'status': [
'Deleted',
'Audio Issue',
],
}
this.router.navigate([], { queryParams }); results in:
Am I missing something? Is there any way to do this? Edit: I'd like it to produce this:
|
I don't follow you @DzmitryShylovich, I am on ~2.4 and seeing this behavior. Also, please see the edit to my original comment. |
@jcroll 4.0.0-rc5 |
Great thank you @DzmitryShylovich @n00dl3 |
Taking @jcroll example:
I'm calling onQueryParamChange when a user selects a new filter, lets say Unfortunately, the I'm observing the
But on it is never called, if I want to add a second value to a |
Has no one some input for that? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
Currently when going to a url with multiple query parameters with the same key the DefaultUrlSerializer is removing all but the last one from the url.
/something/route?room=a1&room=a4&room=a6
This link will be rewritten to:
/something/route?room=a6
What is the new behavior?
Links with multiple query parameters will be left in the url as is and the parameters will be serialized into an array.
/something/route?room=a1&room=a4&room=a6
room["a1", "a4", "a6"]
Does this PR introduce a breaking change? (check one with "x")