Persisting query state across navigation #790
ha1fstack
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are similar discussions asking how to preserve query params on page navigation.
This was my solution, hope it might help someone.
idk if it would work on any adapter or environment but it works for me :)
The search cache is stored in-memory in my example. It saves all search queries regardless of actual usage, you might want to add filtering if it isn't what you want.
I guess it could be integrated with the library itself with some modifications and additional context provider, what do you think?
usage
The adapter context should be placed for each interests (eg. for each page). You can keep the global adapter if you wish.
It saves the query to cache when the adapter unmounts and reloads from the cache on mount.
Beta Was this translation helpful? Give feedback.
All reactions