Skip to content

Maintain URL Parameter Order #777

Answered by franky47
tariwiencke asked this question in Ideas
Discussion options

You must be logged in to vote

There was a proposal to sort search params alphabetically in #638, but after playing with it, it felt very unpredictable. See #638 (comment)

The current behaviour is in line with URLSearchParams: new keys are appended at the end of the query string, and updates to existing values are done in-place.

Doing it such as it follows the order of the object raises the question of what happens when combining multiple useQueryStates or useQueryState updates in one batch, example:

const [, set1] = useQueryStates({ a: ..., b: ... })
const [, set2] = useQueryStates({ c: ..., d: ... })
const [, set3] = useQueryState('e')

set3('e')
set2({ c: 'c' })
set1({ b: 'b' })

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by franky47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants