King Dice
Explore posts from serversTTCTheo's Typesafe Cult
•Created by King Dice on 8/6/2023 in #questions
Problem with page navigation using next/link
try to click the login button and than go back using the back button to understand my problem
https://colibri-dr3kne2f6-spcbfr.vercel.app/
4 replies
TTCTheo's Typesafe Cult
•Created by King Dice on 7/12/2023 in #questions
making sure nothing runs with SSR
I've created an app with create-t3-app, it uses trpc and has two procedures that create a new entry in a firebase database and show all the entries respectively. I then use the usequery hooks to access them I also have the trpc
ssr
option disabled. so with that description is my app using SSR in any way? the reason I am asking is because I want to host on firebase hosting and you have to pay to use cloud functions so I can't do SSR at all32 replies
TTCTheo's Typesafe Cult
•Created by King Dice on 7/9/2023 in #questions
does activating SSR on tRPC mean requests no longer run on client?
let's say I have I am calculating a date in a tRPC procedure, without SSR enabled in tRPC config it will recalculate that date everytime I focus on the window or reload the page, with SSR enabled does the date update only when I deploy?
2 replies
TTCTheo's Typesafe Cult
•Created by King Dice on 7/7/2023 in #questions
question about public and private procedures in trPC
so in the create-t3-app template there is this comment before the publicprocedures
this comments speaks as if the user is the one who is going to exectue the procedures but in reality I choose where this command runs and in what context exactly so what purpose do these different procedures make?
3 replies
TTCTheo's Typesafe Cult
•Created by King Dice on 7/7/2023 in #questions
Can someone explain to me some basic concepts? Eli5
So it seems there are three ways to do data fetching. I am asking about the pages/ dir but I think everything applies to the app/ dir
- fetch data in the page itself (getServerSideProps)
- Making API routes and then using the api routes in my page
- tRPC
when I first learnt nextJS, I don't remember ever learning about api routes, I learnt that you fetch data with getServerSideProps and it's friends.
Then all the tutorials were using API routes, so I was confused, was what I learnt outdated? are there cases where I should use API routes and others where using the nextjs
getServerSideProps
functions was better? To add to the problem, I never got any formal experience with nodeJS so all the new terms like request, response and POST and GET confused me.
Then I watch theo's video tutorial expecting it to be using api routes and it seems to use tRPC, from the homepage tRPC doesn't really explain well what it does, but after using it I really liked it, it seems like a fresh breath of air from the api routes stuff.
But then I had a realization, why did we go from fetching data in the page itself to using API routes in the first place!! like getServerSideProps
seemed perfectly reasonable.
An additional related question is, from my understanding fetching data in the page itself can only be done from one of next's fetching functions getServerSideProps
etc.. (atleast that's true in the pages/ dir) so why am I all of the sudden able to do this inside a normal component function without using any nextjs or react functions.
const { data } = api.posts.getAll.useQuery();
so if someone would ELI5 this whole mess to me I would appreciate it!6 replies
TTCTheo's Typesafe Cult
•Created by King Dice on 7/3/2023 in #questions
where should these variables be in my env var configuration
guys, where should these variables be in my env var configuration? the documentation isn't very clear on the server vs client vs runtime distinction
15 replies