Feature Idea: Load & save params to localStorage as an alternative default on page load #606
Unanswered
tylersayshi
asked this question in
Ideas
Replies: 2 comments 3 replies
-
A thing that's been on the Roadmap for a while is supporting functions for the default value. This could help with this use-case, though it raises the question of when the function should run:
|
Beta Was this translation helpful? Give feedback.
3 replies
-
+1 to this, Is is possible to store the
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So we have a route
/some-page
where we save lots of state in the query params. We want to be able to essentially restore the past session when someone navigates away, potentially even closes the site entirely, then returns to the original page later. To do this, we load query params through local storage.Here is an example of someone on reddit asking for help with the same thing: https://www.reddit.com/r/nextjs/comments/1cz4j87/help_with_storing_query_params_in_local_storage/
This should be fairly easy to work into using nuqs with the
withDefault
method... that being said, I think it still might be useful to give examples in the docs or some built in support for this in nuqs.Happy to help out with a PR depending on what you think here :)
Beta Was this translation helpful? Give feedback.
All reactions