Best way for server/client to react to URL updates as source of truth and avoid excess network calls? #6534
TranscendentalRide
started this conversation in
General
Replies: 0 comments
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.
-
To simplify what I'm looking to do, let's say there is a button that toggles showing or hiding data on the page. The data is always there, loaded from the server, all that changes is showing or hiding.
Now clicking hide/show sets a URL parameter
?show=true
or?show=false
.I want both the server and the client to detect this parameter and show or hide based on the parameter. Once on the client, I don't want to make another network call, only update the url and have the page reactively update. Page history is optionally pushed or replaced.
How can I do this in Sveltekit given it has its own router? Or do I need to create my own store and interact with the native browser history directly?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions