FluX
Explore posts from serversWhat is the substitution for queryKey in useQuery?
If you have a
useQuery
hook like const hook = trpc.getUsers.useQuery({ username })
, where username
is a state that's tied to a search input, the query will re-run automatically when username
changes. No dependency array needed3 replies
How do *you* structure the tRPC router when dealing with isolated components?
In my apps I like to follow this structure: I have two top-level routers - an
adminRouter
and a publicRouter
.
The adminRouter
has many nested routers, e.g. userRouter
or productRouter
, where each nested router contains CRUD procedures for database entities.
Like you, I also have some one-off procedures I need to call in an admin dashboard. For example for clearing caches or for streaming OpenAI response data into an input field.
For that I decided to create a systemRouter
nested under adminRouter
, with routes like /trpc/admin.system.clearCaches
or /trpc/admin.system.openaiTranslation
.
If I'm guessing correctly and you're building a component to display comments of a post, maybe you already have like a commentsRouter
or postsRouter
where you can put that procedure. Otherwise think of a way to group this (and potential future one-off procedures) into a router.5 replies
TTCTheo's Typesafe Cult
•Created by domi? on 3/13/2023 in #questions
Dev stack for almost completely static website
I'd probably use plain HTML and CSS. You can easily port that to a framework later if you do need reactivity
5 replies
TTCTheo's Typesafe Cult
•Created by EQ on 2/25/2023 in #questions
Prisma model name preferences
I like to use
createdAt
and updatedAt
.
There is no right or wrong2 replies
TTCTheo's Typesafe Cult
•Created by WOLFLEADER on 2/18/2023 in #questions
Best CSS for this design
Inherit only works, if any parent has a background color. It'll grab the value from there
43 replies