IceAge2OnDVD
Explore posts from serversNext cookies() not being set on Mutation in App Dir (T3 Turbo)
Trying to set cookies inside TRPC using Nextjs App Router, using the T3 Turbo setup.
Setting cookies works fine inside Queries, but cookies are not set inside Mutations. Maybe I'm doing something wrong, not very up to date with TRPC + App Dir, or it could be a bug in next, not sure.
After calling both the query and the mutation on frontend you only get the cookie from the Query.
But this gets logged to console.
(this is after calling the query first then the mutation.)
19 replies
DTDrizzle Team
•Created by IceAge2OnDVD on 7/5/2023 in #help
Transaction rollback error catching
I'm using drizzle with TRPC and want my api to give detailed reasons for a rollback. However
tx.rollback()
throws a TransactionRollbackError
, which means the TRPC error is never thrown (i think). This means the client sees an error with message "Rollback", which isn't super descriptive.
Is it safe to catch the drizzle error inside of the transaction and throw a TRPC one instead? Im guessing so but just wanted to check.
4 replies
TTCTheo's Typesafe Cult
•Created by IceAge2OnDVD on 6/12/2023 in #questions
Whats going on with these type errors? (Challenge, TSPlayground Included)
No mater how hard I try I can't seem to fix these Typescript errors. Tbh I'm not much of a typescript wizard and I've mostly been guessing at the types, any pointers in the right direction would be greatly appreciated. I seem to fix one error and three more pop up 🤦♂️
Playground (Test-cases & example included):
https://tsplay.dev/Wzxn2N
The aim of the function is to turn an array of objects with a sibling relationship to one with a parent-child relationship. The example input & output in the TSPlayground should make it clearer.
Currently the function works, its just the types are strange.
13 replies