Sean Cassiere
Sean Cassiere
Explore posts from servers
DTDrizzle Team
Created by Sean Cassiere on 8/23/2023 in #help
Type errors with 0.28.3
No description
7 replies
RRailway
Created by Sean Cassiere on 6/17/2023 in #✋|help
Is this memory usage on MySQL normal?
10 replies
TtRPC
Created by Sean Cassiere on 5/8/2023 in #❓-help
Using Response with the Next App Router
The route handlers in the App Router, only receive the Request object, requiring you to use a Response to set stuff onto the response like status, cookies, etc. Previously, we were able to pipe the req and res into the context. My question is: what's the new practice for returning data AND setting the status (or cookies) when within a tRPC router (that's nested using the fetch adapter) in the new Next App Router?
5 replies
TTCTheo's Typesafe Cult
Created by Sean Cassiere on 9/20/2022 in #questions
Creating Zod Input Validation Error after tRPC entry
I've got a ct3a project, with all the bells and whistles (including tRPC and zod). In addition, on the frontend part of the app I've set up a couple of forms with react-hook-form, and I am sharing the zod schemas being used with tRPC. What I'm looking to achieve, is AFTER the input validation by the tRPC router mutation has been completed, and the code has moved on into the logic within the mutation itself, to be able to send back an input validation error and set these errors in react-hook-form. This would be the business logic: 1. User begins registration flow. 2. User enters their email and username along with other fields. 3. React-hook-form uses a shared schema (with tRPC) to validate items such as minLength, isEmail, regex for special characters, etc. 4. User submits valid the form-data to tRPC via a mutation. 5. tRPC accepts and validates the incoming input (since the same schema is being shared on the frontend). 6. In the mutation, the username field is checked in the database to find if it already exists. 7. If username already exists, a BAD_REQUEST error (or something equivalent in the 400 range) would be sent back to frontend, which then can be inserted into react-hook-form. P.S. I have no clue if this (https://trpc.io/docs/v9/error-formatting#all-properties-sent-to-formaterror) plays into what I'm looking for.
64 replies
TTCTheo's Typesafe Cult
Created by Sean Cassiere on 9/20/2022 in #questions
Help - session type in _app.tsx is missing
24 replies