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

fix(router): fix serializeQueryParams logic #42481

Closed
wants to merge 1 commit into from

Conversation

swseverance
Copy link
Contributor

@swseverance swseverance commented Jun 4, 2021

I am currently marking this as a breaking change out of an abundance of caution, because it does make a small change to the way query params are serialized into a url. The maintainers can decide if it truly is a breaking change.

corrects a bug that resulted in query params such as {a: 1, b:[]} being serialized as 'a=1&' instead of 'a=1'

resolves #42445

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

It changes the way query params are serialized into a url

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Something like [queryParams]={a: 1, b:[]} gets serialized as 'a=1&'

Issue Number: #42445

What is the new behavior?

Something like [queryParams]={a: 1, b:[]} gets serialized as 'a=1'

Does this PR introduce a breaking change?

  • Yes
  • No

The url generated by the router link directive will be different if this PR is merged. It will no longer contain the extra ampersand.

Other information

@google-cla google-cla bot added the cla: yes label Jun 4, 2021
@pullapprove pullapprove bot requested a review from atscott June 4, 2021 17:34
@ngbot ngbot bot added this to the Backlog milestone Jun 4, 2021
corrects a bug that resulted in query params such as
`[queryParams]={a: 1, b:[]}` being serialized as 'a=1&'
instead of 'a=1'

resolves angular#42445
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Depending on the presubmit results, we can probably submit this as purely a bug fix (without the breaking change). Will update once those tests have been run.

@AndrewKushnir
Copy link
Contributor

@atscott FYI, I've started a global presubmit for the changes in this PR.

@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Jun 7, 2021
@atscott atscott added the target: patch This PR is targeted for the next patch release label Jun 8, 2021
@atscott
Copy link
Contributor

atscott commented Jun 8, 2021

Global presubmits show no failures so we should be good to submit this as a non-breaking fix.

@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Jun 8, 2021
jessicajaniuk pushed a commit that referenced this pull request Jun 8, 2021
corrects a bug that resulted in query params such as
`[queryParams]={a: 1, b:[]}` being serialized as 'a=1&'
instead of 'a=1'

resolves #42445

PR Close #42481
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 9, 2021
TeriGlover pushed a commit to TeriGlover/angular that referenced this pull request Jul 21, 2021
corrects a bug that resulted in query params such as
`[queryParams]={a: 1, b:[]}` being serialized as 'a=1&'
instead of 'a=1'

resolves angular#42445

PR Close angular#42481
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: router cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Router improperly serializes empty arrays with other params
4 participants