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

React context in Server Component Page

I have a server component page where I want to provide a context having this file and adding it to the page it throws error?? What Im missing here ```ts 'use client'; ...

How do i add custom id in uploadthing?

i was following uploadthing docs, but i cant figure out how to pass custom id via upload btn. i want to pass customId="abc" to that "imageUploader" endpoint via UploadButton. ``` import { createUploadthing, type FileRouter } from "uploadthing/next"; import { UploadThingError } from "uploadthing/server";...

Resources for typescript error handling

Looking for resources for production grade error handling in typescript. I often find myself not caring about errors and want to change this bad habit of mine. Please leave resources, tips and tricks. Thank you!...

From Post to API

Is it possible to post a from to an API Endpoint but stay on the Page without JS ? I have a project that requires me to use JSP (without JS). And I want to add data to a list, and keep that list in view....

Types not matching up when exporting AppType for Hono???

So when I hover my AppType in the api i get a proper output that seems fine (image attached) But when i import it in my expo app, however the AppType it doesn't have the output type not sure why? (image also attached) Check out the repo: https://github.com/jacobsamo/BuzzTrip/tree/mobile When i check out other implementations that seem to work e.g https://github.com/w3cj/hono-open-api-starter and types all work so not sure what i am doing wrong....
No description

T3 + Mongodb + Docker

I'm trying to get a T3 app (trpc, tailwind, prisma, mongodb) running for local development using docker-compose and a different compose file for production deployment. Mongo needs to run as a replicaSet to work with prisma transactions. I find bits and pieces of old blogs and yt videos but nothing solid. Anyone know of a good guide for this? I can't possibly be the only one on the planet trying to do this....

Zustand question in next js

i have this code ```ts export const useTaskStore = create<State & Actions>()( persist( set => ({...

Use eslint-plugin-react-compiler with the new ESLint flat config

Is it possible? Does the plugin support ESLint 9 and above? If it is possible how can I use it? The example only shows the way to use it with ESLint 8 and below (no flat config)...

Help Needed: Jest Fails to Transform UI Package After Migrating from CRA to Vite in Monorepo

Hi everyone, My name is Yotav, and I'm working on migrating my company's Create React App (CRA) to Vite. We have a large application that we've built over the last 7 years, and it's organized in a monorepo structure. The app uses a custom UI package we've developed, and we use Jest for testing. After starting the migration to Vite and making the necessary adjustments, I managed to get most things working. However, I'm encountering an issue where Jest stops transforming the UI package when running tests in the app. It breaks when it encounters the export keyword. I've tried various solutions found online, but none have resolved the issue. I'm hoping someone here can help. ...

Monorepo module resolution issue

Hi everyone, I'm facing an issue with a Next.js application in a pnpm monorepo workspace and would appreciate any help. It's probably just some config issue from my side, but I've been pulling my hair out over this the last few days! I have a monorepo using pnpm with two packages:...

Is storing flags/config as a single jsonb row in a postgres table a reasonable thing to do

I know there are better ways to implement this, but this one was the simplest to write a ui to edit them I'm just displaying formatted json in a monacco editor and parsing and storing it in that column. Aside from potential performance issues, which I don't think will affect us for a good while, are there any other downsides to this approach?...
No description

Nextjs: Reducing outbound bandwidth when google indexes all site URLs

I have noticed that when google indexes all 10k+ site URLs, the outbound bandwidth in fly.io goes very high (8gb+). As my site will continue to have thousands of more URLs as more users use the site, I am wondering how to get around this before I get a very large bill. For context, the project is using Supabase as backend....

Reducing edge invocations vercel/nextjs

It seems that when a route is running on the edge runtime, every visit to it is an edge invocation. Is this true? Got a very high traffic site which is going into huge overages due to a product page which is getting millions of visits a day. I've cached functions inside the page but I assume since the page itself isn't being cached it's counting towards edge invocations. I can't simply make it a static page since there are niche features which makes the page rely on multiple cookies (1 example is each customer has personalised product prices based on a unique customer cookie). Any solutions for reducing the invocations related to this page whilst keeping the cookie dependencies?...

Error while trying to upload video file

Ima having troubles trying to upload video files with sizes around +100mb. With version 6.13.2 O get a Retry error and in version 7.0.2 I get a this cors error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sea1.ingest.uploadthing.com/6Fnf16reBVoHaY0M12KN6Q5wuLC2YUXvTViby7Ffj0nJH8Gl?expires=1728073825081&x-ut-identifier=es5j20zkec&x-ut-file-name=2024-08-16%252017-17-53.mp4&x-ut-file-size=238152949&x-ut-file-type=video%252Fmp4&x-ut-slug=lessonVideoUploader&x-ut-content-disposition=inline&signature=hmac-sha256%3D682c9f0f44a2e78c34e547aaf9f2d235e47f1d6ff7de29161567124e7ff7a018. (Reason: CORS header β€˜Access-Control-Allow-Origin’ missing). Status code: 504. This what I get with the debug logs in v 7.0.2 ```...

Restore mongodb data during Docker build

I want to restore mongodb data from my backup created using mongodump command . And i want to restore mongorestore it during build time so it can be used directly without further doing anything, There is a case , i successfully restore after container run but not able to restore data during build time. Is there any way you tried earlier .Really tired from this task 😣😣

nextjs refresh, trpc invalidate order

Does anyone know if order does matter and has any implication in case of trpc invalidation and router.refresh ? ```ts await apiUtils.invalidate(); router.push('/location');...

I can't figure out how to add "up to 10 developers"

I've scoured the site, closest thing is in the profile tab "add email" but I assume thats to add alternative emails for my own account and it doesn't seem to work for adding my devs. Maybe because they have their own accounts already?

Max Connection Issue with Supabase + Vercel

I am running into max connection issues when I am using supabase within an application hosted in a serverless environment (vercel). I've done everything I can find by the docs, but if I have a spike of 300+ users on my app at once, I start to run into a lot of max connection errors. I am using trpc to help batch request and limit connections made. I create the postgres connection outside of drizzle, set max connections to 3, and pass the instance in. ...

ESLint error in NextConfig when customizing webpack

When I try to extend webpack in NextConfig, ESLint doesn't like that the config parameter is any type. How can I get around this?
No description

Asking for Advice to Study/Understand the App Router

Hi everyone! Recently I've been trying to understand how the app router of t3 works under the hood and I've made a diagram of how things are connecting to each other. But I think I've hit a roadblock because some of the utilities used in this implementation are not even documented on tRPC website and seem to be very "bleeding edge". (e.g. createHydrationHelpers ) Do you think there's an easier way than diving into the tRPC/RQ source codes to understand how things are working here?! ...