I have a svelte store object user
that is set to another object consumer
whenever the consumer
object changes:
$: $user = consumer;
I can see that user
is being updated however when I change the route by either button click with href or window.location.replace()
the store appears to be reset.
I couldn't find anything in the docs about this. How can I persist the store across route change? Thanks for your help.
For (probably my own) future reference:
I worked out the issue. I am using sapper - I should have been using goto()
as documented here: https://sapper.svelte.dev/docs#goto_href_options