I need a store where the server can modify it's default value #11937
Replies: 1 comment
-
A link to an example would help alot |
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
Uh oh!
There was an error while loading. Please reload this page.
-
I need a store that has a server-side default value. If this store is changed during SSR, the new value is used as the client-side default value. Is this possible in SvelteKit?
The use for this is to hold the user locale.
Currently, the server determines the user's prefered locale based on a request hook and then sends the page content in the determined locale. The locals object is used to keep track of the user locale. As soon as the layout mounts, the store (which is reset to the default value) will be set to the locale in the locals object. This triggers a derived store to load the translations asynchronously. During the period when the store is reset to the default value until the translations are loaded, the translations store is empty.
So now again, how can I tell my store to remember the value the server gave it?
Beta Was this translation helpful? Give feedback.
All reactions