0

The task is as follows: Store all selected filters, sorting and search as a part of url. E.g.

?searchStr=someSearch&sortBy=date.asc...

Reason for this:

  1. copy pasting such url is convenient because user can go to it and have the same filters already selected
  2. on page refresh the state of filters won't be lost

issue I found that max length of url is about 2000 characters. User in the app may (potentially) select a lot of filters(some of them are multiselects), meaning url length may become quite lengthy.

Are there some known practices about how to solve this issue?

I can think only about two possible solutions:

  1. If select an option, store only it's id (without label, etc.)
  2. make filter group key name as short as possible. E.g. instead of
?searchStr=someSearch&sortBy=date.asc...

make it

?sS=someSearch&sBy=date.asc...

It would probably add a lot of complication and overhead (because need to then convert shortended keys into normal ones)

Any suggestions and help is much appreciated

Alex Tarasenko
  • 451
  • 4
  • 8
  • Does this answer your question? [How should I handle very very long URL?](https://stackoverflow.com/questions/27465851/how-should-i-handle-very-very-long-url) – juliomalves Jun 12 '21 at 11:38

0 Answers0