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

upload on onClick()

is there any way that when i upload the image, it wait for a onclick() and then uploads to the uploadthing database? cause it's annoying when you realize that you made worong uplaod

Handling Third-party lib client component that relies on ENV vars.

Hi, I am currently trying to add search on my project, and I stubbled upon a common scenario that I don't know how to handle yet... I am trying to use Meilisearch with react-instantsearch library....

Tree shaking object based API SDK

Hey guys, I use this internal sdk I built all the time, it works great but Im trying to get it treehsaken correctly. Heres a small snippet of what it looks like ```ts...

is using clerk w/react native worth it?

im using expo w/react native, this means that i cant use clerk's prebuilt components or account portal, and need to make a custom ui anyway, so are there any features that clerk offers, that supabase doesnt? (since im using it for the db anyway)

<img /> flicker on transition when conditionally rendering separate lists

Wondering if any highly knowledgable react people might be able to help me with this problem- i don't really have any idea for a fix i have an array of data that i render. this array, however, can be either read-only, or editable, depending on whether it is the user's own page or if it's another user's page (image 1) option a) is to embed all of the editing logic (mostly just sorting with drag and drop) inside of some sort of List component, and then pass a boolean to the List component which decides to render the editable ui or the read-only ui. this works perfectly fine...
No description

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 */ ) }...
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.
Next