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

Don't sort query params #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Ravenstine
Copy link

When a query string is generated, the generateQueryString function sorts the params alphabetically.

This behavior isn't exactly flawed, but it's unexpected and provides no meaningful benefit. If a developer always wants their keys to be sorted, it should be done before passing them to the recognizer. The current implementation makes it impossible to choose how query params are sorted.

I ran into an annoyance with this recently when I changed a route to always be redirected to from an index route at the same level of the hierarchy; this is done by calling replaceWith and passing the current queryParams to that function. The queryParams are passed in the correct order that's already expected, but what happens now that the queryParams get sorted by the recognizer is that my acceptance tests (which assert that the current URL is correct) for the target route have several failures now that the queryParams are sorted differently. It's not something that can't be easily fixed, but it's extra time the developer needs to spend and is overall unexpected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant