Next.js Discord

Discord Forum

Best way of persisting table preferences across sessions?

Unanswered
Hudsonian Godwit posted this in #help-forum
Open in Discord
Hudsonian GodwitOP
I have a table which is server side filtered/sorted via query params. What is the best way of persisting these parameters between sessions? I tried using local storage but It didn't feel smooth at all because of the hydration mismatch.

My next approach would be to save the url in the cookies and then redirect the user in the middleware.
(eg. /table -> "/table?sort=xyz&filter=asd")
Is this valid or is there a better way?

0 Replies