SolidJSS
SolidJS2y ago
42 replies
icanflyit

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?
Was this page helpful?