Replies: 1 comment 3 replies
-
I don't believe there is a way to restore route state like this, the best way would be to use a store if you are running it in SPA (by default). @jakobrosenberg might have some more insight into this |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am looking for a way to save and restore the state of a route -- i.e. save and restore the instance of a svelte component at a route, automatically (without having to create a store). For example, consider the situation where I navigate to a page with the url
/chooseDogBreed
and on that page I can select one of a few dog breeds, and my selection is saved to a variable calledfavoriteDogBreed
inside the svelte component for that route. Next, I would like to navigate to another route (doesn't matter which), and then return to/chooseDogBreed
but using the previously created instance of the svelte component for that route so that my variable(s) states are saved, e.g.favoriteDogBreed
is still set to my choice.I do not think this is currently possible using the routify API, but please correct if I am wrong. If I am right, I would like help finding the part of the routify source code that handles constructing the svelte component at the current route. I may be interested in forking routify to make this functionality possible.
Thanks for taking a look!
Beta Was this translation helpful? Give feedback.
All reactions