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

Optimistic updates type error [Symbol.iterator]()

i'm trying to use optimistic updates on my mutations but i'm getting this type error ´´´(GetResult<{ id: string; createdAt: Date; name: string; backgroundImage: string; userId: string; }, unknown> & {})[] | undefined' must have a 'Symbol.iterator' method that returns an iterator.``` i literally just copy and paste as the docs and i don't now what to do...

"The property 'withTRPC' in your router collides with a built-in method

Hello guys I am having some troubles on solving this issue when I hit npm run build: Anyone has a clue what is about? ...

TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?

So I have a TRPC infiniteQuery: ``` const { data, fetchNextPage, hasNextPage } = trpc.server.getAll.useInfiniteQuery(...

Using cache with drizzle

How exactly would I use cache with the select from drizzle? if it was just the method it would be simple, but it returns from that returns where and there's all the other methods. How the hell am I supposed to do this?
Solution:
caching everything under one mega function is a way to do it

Form action expects a string?

Sorry to paste an image but it's necessary to see the error - this component keeps giving me the problem that "action expects a string" - why?!?!

easiest way to convert shadcn css vars to a different tailwind swatch?

i've got all of the css vars auto gen'd, and i'm frankly just too lazy to manually identify which value of slate that each of these correspond to and then manually replace them with a different swatch. is there a not super annoying way to do so? my next option is to write some cursed python parsing lol```css --background: 0 0% 100%; --foreground: 222.2 47.4% 11.2%; --muted: 210 40% 96.1%;...

Plasmo messaging between content scripts and tab pages

Hi I am struggling to get my head round how I would communicate between content scripts and tab pages. TlDR I want the ability to control multiple webpages in the background with a UI, is this the best way?...

Drizzle many-to-many error

When running push from drizzle I am getting an error: ``` Error: target: db.-.primary: vttablet: rpc error: code = InvalidArgument desc = Duplicate column name 'user_id' (errno 1060) (sqlstate 42S21) (CallerID: ki0zccg3vsi73wcswazm): Sql: "create tab le users_to_clubs (\n\tuser_id int not null,\n\tclub_id int not null,\n\tPRIMARY KEY (user_id, user_id)\n)", BindVars: {REDACTED} at PromiseConnection.query (/home/blue/Clones/tr-clone/node_modules/.pnpm/drizzle-kit@0.19.3/node_modules/drizzle-kit/index.cjs:34740:26)...
Solution:
Rewrote with copy past from docs, seemed tk fix it

next email library

Hello im working on password recovery by email feature in next js. which mailing lib/service u suggest

What do you think about putting eslint config in package.json?

Personally I like to group things in the same file, but curious why ct3a doesn't do this. Any drawback?...
Solution:
Json doesn’t allow comments and isn’t typesafe

Vercel Analytics

Is it possible to embed the data from vercel analytics into a page? So I can make it visible to people who dont have the dashboard access? Is there another analytics type solution that does do that if vercel doesn't?

Drizzle Insert w/ Relation

Hi, What is the way of inserting a new record with a relationship in Drizzle. I understand that Prisma abstracts this away as if you are inserting everything as once but under the hood it breaks it up into multiple queries. Is there anything like this in drizzle?...
Solution:
The way to do this in drizzle winded up being just putting everything in a transaction. Docs: https://orm.drizzle.team/docs/transactions...

how to delete file in uploadthing

can anyone tell me how to delete file in upload things?

t3 turbo env vars

So I have a secret key that i am using in one of my api routes. Everything works fine but when i go to deploy in AWS amplify it doesnt work. I added it to the environment variables... I tried building with-env not sure why its not working. Also have this issue with my cloudflare envs in amplify. ```ts...

Making a enum/union type like in prisma, but with drizzle

I have this a role pgEnum and I want to make a enum type that is also a union type, like what happens in prisma when you make a enum ```ts export const role = pgEnum("role", ["USER", "ADMIN"]); // This is what i'm currently using...

problem importing first npm package

I’m trying to import my first npm package and getting a “cannot find module” error, funnily, with it still working. I put up a description and links up here, but I’m wondering if this forum is a better place to be seeking help? https://www.reddit.com/r/nextjs/comments/14p9c00/importing_my_first_npm_module_fails_with_error/...
Solution:
ok, got some help on IRC to figure it out. If I change the main fom cjs to esm it appears to work. Don't really understand it (is it because I'm exporting named objects?) but it works!

where should these variables be in my env var configuration

guys, where should these variables be in my env var configuration? the documentation isn't very clear on the server vs client vs runtime distinction
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
...
Solution:
```ts import { createEnv } from "@t3-oss/env-nextjs"; import { z } from "zod"; export const env = createEnv({...

Refactor type

I got a type def - ```js // Clear this mess type GeneralCondition<T extends ValidSubscription> = { [K in T as T extends SubWithoutBroadcasterId...

"no-cache" | revalidate: 0 breaks site in production

As title say, "no-cache" and "revalidate: 0" breaks site in production, on local it works fine. Also, setting it to something like "revalidate: 5" works. Repo: https://github.com/Apestein/nextflix/blob/bug-branch/src/app/page.tsx And as you can see the website has 404 error, it gives no error during build time https://nextflix-8xfr94may-apestein.vercel.app/ This deployment uses revalidate: 5 and as you can see it works: https://nextflix-blush.vercel.app/...