noynek2242
noynek2242
Explore posts from servers
TTCTheo's Typesafe Cult
Created by noynek2242 on 3/8/2024 in #questions
Decimal Warning
ugh. The JSON stringify is breaking date objects so I've just moved the problem.
3 replies
TTCTheo's Typesafe Cult
Created by noynek2242 on 3/8/2024 in #questions
Decimal Warning
I was able to make the error go away by JSON.parse(JSON.stringify(myDataWithDecimals)) when passing from the server to client component. Feels like a hack though.
3 replies
TTCTheo's Typesafe Cult
Created by noynek2242 on 2/24/2024 in #questions
Sharing Logic Across TRPC Procedures
Thanks. Turns out I was basically doing what it says to do in that server-side-calls section. The part I was missing was finding the right types from Prisma so I could pass around the DB items. The trick there was to import
import { type Prisma } from "@prisma/client";
import { type Prisma } from "@prisma/client";
and then explore those definitions until I found one that made sense. Thanks
3 replies
TTCTheo's Typesafe Cult
Created by noynek2242 on 2/21/2024 in #questions
Client/Server Mutations
Ok, spent a few hours on this and here's what I ended up with: The way T3 is setup using the Next.js App Router, it seems like my api router is already using server actions, but maybe I'm misunderstanding. OnSave, I'm able to call the api router with mutation.mutateAsync(values); My Next challenge was how do I take those returned values and repopulate the form? The issue being if there are any differences between what was saved vs the state of the form. This one took me a while because I'm using uncontrolled form field. What seems to work is to use the React Hook Forms reset method to replace the default values. Anyway, I don't know if there's a better way, but it seems to be working.
7 replies
TTCTheo's Typesafe Cult
Created by noynek2242 on 2/21/2024 in #questions
Client/Server Mutations
Great, thanks for the direction. Definitely wrapping my head around the server-oriented direction still and trying to understand the patterns. Thanks
7 replies