Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

Protected Procedure Not working even when logged in (on server side)

I have a tRPC procedure using protectedProcedure, but it's throwing an error when I'm calling it using apiServer[pic 1] and being clearly logged in.
No description

Weird field error with React Hook Form (using Shadcn Form)

Im working on an app using the T3 stack. Im using Shadcn for the form and using the React Hook Form useFieldArray hook to dynamically add and remove fields. The issue i am running into has to do with field validation. I defined a Zod schema for the form, but when i submit i get this error: ```json "errors": { "": {...

Auth Library Suggestions

I’m currently developing a iOS app in Swift and I’m trying to use a WebAuth session, however it seems nextauth does not work with a native swift app. Any suggestions on what to use instead?

tRPC example file structure question

Hi I'm reading tRPC docs for nextjs and they have a different file structure on their example. Would layout.tsx be the equivalent of pages/_app.tsx or page.tsx? I'm not sure as my page.tsx has the code below and it looks nothing like the example ```tsx export default async function Home() { return ( /* components */ ) }...
Solution:
Yes, it should go in your root layout. Look at Create T3 App for an example.
No description

expo secure store

My app can write to secure store in dev tested on android emulator but in production it errors as ERR_WRITE. Just storing a simple name and token so storage is likely not the problem? I checked permissions and I don’t seem to be missing anything per expo docs. Anybody help?

where is signup with email and password option at?

I’m on the site, The default is using discord… I don’t want that. I want signup with email and password....

I have a nested create many query I am getting Unknown argument 'QuestionOptions'

(v5.17.0)CockroachDB , I restarted the application I have removed all migration. I have re-migrated the data again. and push the data. But I'm still having this problem...

Handling ADHD while programming

This is kind of an off-topic question, but I thought some of you might have an interesting point of view / experience, or some resources to share. I have a friend who is very new to developing and who started working at my company. I'm basically giving him time to learn and teach him a lot about web dev myself. He is very motivated, but has days where he just can't function due to not being able to focus. On these days no progress is notable at all. ...

Session user id does not get added to session

My code: ```ts import { PrismaAdapter } from '@auth/prisma-adapter'; import { type DefaultSession, type NextAuthOptions, getServerSession } from 'next-auth'; import type { Adapter } from 'next-auth/adapters';...

get url after uploading in client side

so i have this form and my logic right here is to upload the file, then to get the url, so i can make a POST request to the server side and otherwise to mongoDB, but the thing is when i upload the image to from my client side, how can i make the way that i get my url in client side, so i can make an api request?. Yes im a noob....
Solution:
🫡
No description

NextAuth problem in production on Vercel

Hey, I am having trouble using NextAuth in production, despite using it just fine in my development environment. I am using Prisma as well. I tried removing the NEXTAUTH_URL from my environment variables in production based on this https://next-auth.js.org/deployment#vercel, as well as removing the authOptions export from '~/server/auth' based on this https://github.com/vercel/next.js/discussions/50511 Unfortunatley neither of these solutions seemed to work, nor did the solutions that I have looked through here. I am using the Email provider, and the Google provider btw...
Solution:
i think you just have to add the google provider secrets in the env.

how to make c.get("jwtPayload") type safe in hono

how to add type to jwt payload in hono js
Solution:
```ts type Variables = { jwtPayload: string } ...

Why is HydrateClient in page.tsx and not in layout.tsx?

Hey I was wondering why the HydrateClient Component is not in the root layout. I couldn't think about a scenario where I wouldn't want to hydrate it 🤔...

Is there a reason i cannot use "use server" inside buttons anymore like the example shows.

× It is not allowed to define inline "use server" annotated Server Actions in Client Components. │ To use Server Actions in a Client Component, you can either export them from a separate file with "use server" at the top, or pass them down through props from a Server Component....
No description

how do you handle api calls?

Do you have a pattern or something? fetch seems too bad. i have to add a base url, explicit seach params params and many more things. Im using react query but i still hate the way i do api calls. someone in our team said we should use RTK query. and it handles all the parts.

NextAuth Callbacks

I'm currently trying to implement my nextauth instance in an ios app, but im having some trouble implementing callbacks that pass the session id and user id/token back to the app. I'm currently just using the credentials authOption, but if anyone could point me in the right direction that would be great. Thanks! ```ts export const authOptions: NextAuthOptions = { callbacks: {...

Next.js/tRPC Prefetch w/ HydrateClient "Error occurred prerendering page"

Hello all, I'm trying to get to the bottom of an issue I'm having using prefetching with HydrateClient. I'm using the t3 stack, so I believe that HydrateClient is a helper function wrapping tRPC helpers.dehydrate()... When I run this code with pnpm dev, it works fine, but when I go to pnpm build, I am getting ``` Error occurred prerendering page "/queue". Read more: https://nextjs.org/docs/messages/prerender-error...
Solution:
I FIXED IT! Stupid mistake, wasn't marking the root page function as async... i.e: Broken: ```ts export default function QueuePage() {...

storybook like playground

Hey, I'm creating shared react components library. It will be used by couple of frontend apps in my project. I want developers to preview and play with this component library. It's there something newer or better than storybook for this?

Do I need `HydrateClient` on every Next.js route?

I'm trying t3 stack for first time, and I noticed that in Home route component, there's a trpc prefetch and a HydrateClient component wrapping all the elements. I assume that is supposed to make streaming pending prefetches to work, right? How can abstract that? For example avoiding repeating HydrateClient every time I have a prefetch. And also even avoiding the prefetch call at all by configuring something at the useQuery level?...

Vertical scroll on element with dynamic height

I am using tailwind with reactJS. I am trying to create an element which fills the remaining space within its parent vertically, this element will then have children which should be able to overflow - in which case the parent should be scrollable. Currently I am having trouble ensuring that the parent fills the remaining space - I am using a primarily a combination of flex flex-col flex-grow to make the components fill as much of the vertical space as I would like. However - right now I find that if I set the 'scrollable parent' element to flex-grow - it will initially fill the desired amount of vertical space - however, when its children come to the point where they overflow it vertically (at which point i wish to scroll) the size of the parent container simply extends to accomodate its children. How is it that people typically go about achieving this type of effect, e.g fill the rest of the remaining vertical height and make that section scrollable....
No description