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

Change object serialization for hash-params #344

Open
nomego opened this issue Mar 4, 2020 · 3 comments
Open

Change object serialization for hash-params #344

nomego opened this issue Mar 4, 2020 · 3 comments
Assignees
Projects

Comments

@nomego
Copy link
Contributor

nomego commented Mar 4, 2020

Currently we serialize filters with objects as twice(!) URLEncoded JSON, making a supplier filter such as

[{"id":"00000000-0000-0000-0000-000000000000","name":"My Supplier name (organizational number)"}]

(98 characters)

first become

%5B%7B%22id%22%3A%2200000000-0000-0000-0000-000000000000%22%2C%22name%22%3A%22My%20Supplier%20name%20%28organizational%20number%29%22%7D%5D

(140 characters)

and after the next encode become

%255B%257B%2522id%2522%253A%252200000000-0000-0000-0000-000000000000%2522%252C%2522name%2522%253A%2522My%2520Supplier%2520name%2520%2528organizational%2520number%2529%2522%257D%255D

(182 characters) an increase of 86%

The main issue with this is that we use the complete URL in FE when we call CheckStatus to ensure that the user is logged in, and when the user has selected a lot of filters, we violate the max length of a query parameter.

Also, it's very hard to read those filters.

There seems to be at least two versions of "JSUrl" trying to solve this, https://github.com/Sage/jsurl and the "successor" https://github.com/wmertens/jsurl, where the serialized data becomes both readable and often shorter than raw JSON (which we can't use because of risk of '&' characters, primarily.

Omnitable also needs to export helpers for serialization and deserialization so it can be imported and used when linking from other FE views, for example (start-page with clickable charts as an example).

@nomego nomego added this to To do in April (Saint Drogo) via automation Mar 4, 2020
@cristinecula
Copy link
Collaborator

@nomego Why do you need the complete URL for the CheckStatus call? Why not drop ?params in #/path?params?

@nomego
Copy link
Contributor Author

nomego commented Mar 4, 2020

@nomego Why do you need the complete URL for the CheckStatus call? Why not drop ?params in #/path?params?

If CheckStatus fails, BE might redirect to a federated IDP, flow described in https://github.com/Neovici/cosmoz-frontend/issues/2022. To restore the UI state after that round trip, we need the complete URL.

@nomego nomego removed this from To do in April (Saint Drogo) Apr 5, 2020
@nomego nomego added this to To do in May via automation Apr 5, 2020
@megheaiulian
Copy link
Collaborator

@nomego Recent changes in autocomplete,list,list-horizontal introduce a new behavior that partially fixes this problem. Now the filter will be a an array of simple strings or numbers instead of objects because of value-property.

@nomego nomego removed this from To do in May May 15, 2020
@nomego nomego added this to To do in June via automation May 15, 2020
@JockeCK JockeCK removed this from To do in June Jul 21, 2020
@JockeCK JockeCK added this to To do in August via automation Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
August
  
To do
Development

No branches or pull requests

3 participants