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

useLayoutEffect vs useEffect (with a setTimeout)

I am conditionally rendering a list of input elements. I want to give the first element focus when they are rendered. I added refs to the inputs and a useEffect where I focus on the respective ref (when the change happens). Adding refs to the input - ``` // inside the map...

Really dumb question about React Compiler

I figure this is a question someone deeper into the React ecosystem can answer. I've read some of what the React Compiler can do, but I'm not quite grokking it. Does React Compiler simply run through JavaScript and React code and improve its performance? Or can it be used to compile React code in such a way that it can be run standalone? As in, does it compile, optimize, and minify the code in such a way that I can run it on another application without that application running an instance of `re...
Solution:
the compiler adds memoization (remove unnecessary rerenders) from react

supabase realtime 401 error

anybody using this service?, I need to change the UI in Next and no matter what I do I always get this 401 error. I have created the ssr client(browser client), also enabled with anon or disabled RLS, I have tried every combination available but no luck. I have read the docs and no luck, their youtube video about next, no luck, is this service just broken? lol, I see no questions asked about this service in any group....

Next auth error=OAuthCallback

Someone that knows how I can troubleshoot why I get error=OAuthCallback in my url when I am redirected back to my page for Apple Sign in with NextAuth? 🤔 It works fine for Google Sign in and Email / Password sign in......

S3 presigned url

Question about S3 hopefully I can get an answer on. Scenario: Presigned URLs, if a user starts an upload with a presigned url. The upload stops, and they need to restart the upload at a later time. Also this file is 10gb in size. Questions: 1) if the presigned url expires before the user resumes the upload can you get a new presigned url for the same file? ...

I want to upload user generated adult content

And for that i kinda need to use my own buckets instead of theo's and probably have the hability to store files in google cloud, azure and anywhere else. Is there an option for that? didn't find anything on the docs.

How to use state management (Zustand) but still make use of "use server"

``` <div className="flex flex-col p-2"> <form action={async () => { "use server";...

Files wouldn't upload, no errors

Hello, when I try to upload, this just happens, I keep seeing these requests and it's showing a loading state on the button my code looks something like this, and UploadButton is same from documentation, NextJS ```ts <UploadButton...
No description

attendance system (image processing)

I want to create an image processing system. Basically a mobile app in which I can take pictures or videos and then it will mark students present or absent based on that . Is it possible to do that. ...

How do you add a new field to Session User in NextAuth using T3 stack?

I added this in my auth.ts ```declare module 'next-auth' { interface Session extends DefaultSession { user: {...

Queryraw condition joining in Prisma

This question was also posted in the Prisma Discord but it's been a few days without replies. https://discord.com/channels/937751382725886062/1244937417493053440 I need to use a procedure and then filter on this from a sqlserver database. I am having some issues constructing a query that is dynamic and safe. Prisma.join is only for joining values, but how do I join conditions? What makes it complicated is that the conditions are dynamic filters. Some some may be present or not. ...

Fetch from within trpc isnt working in vercel?

I found maybe one other guy that had this same problem but his fix was odd to me. Has anyone had this issue where if you do a post request from within a trpc router procedure, you get a content length mismatch? this happens only when deployed to vercel. weirdly enough (or not?) this works ok for GET requests... ``` protectedProcedure .input( z.object({...

Drizzle with multi-file schema not working.

So drizzle itself is working, but i cant make queries with "with" because the relations seem off. but with innerJoins it works and also when i put it in the schema.ts file it works. pretty sure i am configuring something not right in my index.ts file in my db folder (screenshot attached). any help is appreachiated!
Solution:
in case anyone has a similar question: this is my index.ts file now that seems to work
No description

Weird Vercel behavior.

hi! I'm trying to figure out why Vercel is losing it's mind about me using telemetry & the 'server-only' package together. I get the following error on build once it makes it to vercel: ``` /src/server/queries/users.ts:2:1 Module not found: Can't resolve 'server only'...
Solution:
it's server-only, not server only

Get speech duration before starting narrating using the speechSynthesis API in browser, JS/TS

Requirement - 1. Text to speech inside browser on frontend, preferrably reactjs 2. Geet the time period for which the browser will speack out the given text ...

updating @auth/drizzle-adapter from 0.7.0 to 1.1.0

Hi there, Im tring to get the auth drizzle-adapter of my t3 app up to date. Everything has been working perfectly for the last months, but when I try to update @auth/drizzle-adapter from 0.7.0 to the latest 1.1.0 everything breaks. Im using NextJS together with Drizzle ORM and tRPC. tables sessions, account and relations are existing as before. ...

Error in Nvim with TS related LSPs.

Whenever I try to use my LSP in a TS/JS related environment it can seem to find any of the files to run like tsserver, tailwindcss language server, prettierd, eslint_d. They all throw errors about file not found. ``` [ERROR][2024-05-29 11:36:05] .../vim/lsp/rpc.lua:770 "rpc" "/home/ziim/.local/share/nvim/mason/bin/typescript-language-server" "stderr" "node:internal/modules/cjs/loader:1148\n throw err;\n ^\n\nError: Cannot find module '/home/ziim/.local/share/nvim/mason/typescript-language-server/lib/cli.mjs'\n at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)\n at Module._load (node:internal/modules/cjs/loader:986:27)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)\n at node:internal/main/run_main_module:28:49 {\n code: 'MODULE_NOT_FOUND',\n requireStack: []\n}\n\nNode.js v20.13.1\n"...
No description

Uploadthing Error

I just added one column to my db in drizzle but now when i'm trying to upload anything on my development server, it's throwing an error. Can somebody help me out please?
No description

column userId doesn't exist

but I made sure my schema has it. I used drizzle btw.
No description