Zikado
Explore posts from serversDifferent server context when using "use server"?
Hi, I was trying to create a simple game project where player lobbies would (for simplicity) be saved on the server. Then I wanted to create some RPC using the "use server" so I can for example check whether the specific lobby exists etc.
But I encountered that the state of the variable differed in the RPC functions and the rest of the server context, let me show an example on random number variable.
src/server/number.ts
Then I created API endpoints just to be able to easily check whether the numbers match
src/routes/api/getRandomNumber.ts
This is the RPC for getting the random number
src/routes/utils/callbacks.ts
Lastly I have a page where I get the data from both sources so I can check whether they match
And this was the result:
RPC: 0.7921163507084992
API: 0.4117746060818235
This probably comes from my lack of knowledge but I would really appreciate any explanation why does it behave that way and what is the proper way to handle it/change it to more suitable solution.
Thank you in advance.
5 replies
TTCTheo's Typesafe Cult
•Created by Zikado on 3/1/2024 in #questions
Planetscale billing
Hi, on account of the Theo's video about Netlify billing I panicked a little. I tried to find a mention about what happens when Planetscale free tier exceeds but only with a little luck in FAQ saying "Databases that exceed the Hobby plan in usage or storage without current billing may experience degraded service." which does not really rule out billing, so my question is what happens when exceeding the free tier? Thanks for any insight.
9 replies
TTCTheo's Typesafe Cult
•Created by Zikado on 11/25/2023 in #questions
Compiling user's code - the right way
Hi, so I have been trying to create some kind of a leetcode like app for JS code only in my SvelteKit app. I run into a problem that I have no clue how to actually do that right. I have already been able to create something using 'isolated-vm' but it does not look like the best way to do it.
So that's it I guess, hope someone smart will come by this, thanks for any help :).
4 replies