icanflyit
Explore posts from serversHow to do client side redirects
Quick client vs SSR question: What is the recommended way to do a redirect from the client side? My understanding is
throw redirect()
is only available from an SSR context.
Also, if I wanted to redirect regardless of whether I was client of server side, would "use_server"
along with throw redirect()
be appropriate there. If not what would the recommended way to do this be.13 replies
SSR Cookies
Hi all,
I'm new to SSR and don't fully understand in the solidstart basic example which components are being rendered server side / client side.
I'm using tanstack solid-query and for testing I have a button that on press calls a /click route on my server and adds a row to the database consisting of:
- a deviceId cookie
- the current time
I then have a /clicks routes that gets the number of clicks for each deviceId (and i use createQuery to use it in solid)
Every time the routes /click and /clicks are called, the server checks if deviceId cookie exists and generates a new deviceId if not.
This works great if I have a button or something that forces the query to be done client side, since all the client side cookies are passed, however if I try to get the value of that query on the official page load, the cookies aren't passed and so the initial state always begins at 0
My question is is there a way to pass the client cookies when making server side requests?
43 replies