Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

State to url => order of attributes #221

Closed
maxiloc opened this issue Sep 24, 2015 · 12 comments
Closed

State to url => order of attributes #221

maxiloc opened this issue Sep 24, 2015 · 12 comments
Assignees

Comments

@maxiloc
Copy link
Contributor

maxiloc commented Sep 24, 2015

Following algolia/instantsearch#128

Can we keep the order in the generated url string compared to the trackedParameters

@pixelastic
Copy link
Contributor

Just to clarify, what you would like is that given a trackedParameters of ['query', 'index', 'page'], then you would like the url to look like q=foo&idx=bar&p=0 (with the query string variables in the same order than the trackedParameters array?

This seems feasible for such an easy use-case, but will start to get complicated for the attributes:* that stores all the facets...

Could you expand on your use-case and why you would need this?

cc @bobylito

@maxiloc
Copy link
Contributor Author

maxiloc commented Sep 29, 2015

Yes the goal is to be able to have query, index and page before attributes so that it is easy to modify in the url. Right now you can not ensure that.

@bobylito
Copy link
Contributor

What about the parameters that are already in the URL (before we add ours)?

@maxiloc
Copy link
Contributor Author

maxiloc commented Sep 29, 2015

For my integrations we can erase them

@maxiloc
Copy link
Contributor Author

maxiloc commented Sep 29, 2015

But it could make sense to keep them

@vvo
Copy link
Contributor

vvo commented Sep 29, 2015

Maybe since we are always ordering the parameters (#224) we are could be good here? Because modifying the parameters by hand is something WE developers only do..?

We just need to ensure to always loop using the same order.

Having always the parameters in the same order for everyone may be better here for us to debug/follow?

@maxiloc
Copy link
Contributor Author

maxiloc commented Sep 29, 2015

Yes that works but I would just put attributes at the end

@bobylito
Copy link
Contributor

@vvo #224 is not related to that issue.

Predictability is a must :) So the order would be : named parameters, named attributes (we can specify attribute:price) , attribute:*, remaining parameters from the URL that are not ours?

@maxiloc
Copy link
Contributor Author

maxiloc commented Sep 29, 2015

@bobylito 👍

@bobylito bobylito self-assigned this Sep 30, 2015
@bobylito
Copy link
Contributor

Will PR in qs so that it supports sorting keys. See ljharb/qs#64

@bobylito
Copy link
Contributor

bobylito commented Oct 8, 2015

qs 5.2.0 released, let's get back to work! :D

@bobylito
Copy link
Contributor

bobylito commented Oct 9, 2015

see #227

@vvo vvo closed this as completed in f8fc145 Oct 9, 2015
dhayab pushed a commit to algolia/instantsearch that referenced this issue Jul 10, 2023
…ix/urlparamsorder

Serialization of parameters in query strings are ordered FIX algolia/algoliasearch-helper-js#221
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants